code: public static SDVariable squash(SameDiff SD, SDVariable x, int dim){
          SDVariable squaredNorm = SD.math.square(x).sum(true, dim);
          SDVariable scale = SD.math.sqrt(squaredNorm.plus(1e-5));
          return x.times(squaredNorm).div(squaredNorm.plus(1.0).times(scale));
      }
docs: Compute the squash operation used in CapsNet
  The formula is (||s||^2 / (1 + ||s||^2)) * (s / ||s||).
  Canceling one ||s|| gives ||s||*s/((1 + ||s||^2)
  
  @param SD The SameDiff environment
  @param x The variable to squash
  @return squash(x)