Table Of Contents
Table Of Contents

mxnet.ndarray.square

mxnet.ndarray.square(data=None, out=None, name=None, **kwargs)

Returns element-wise squared value of the input.

\[square(x) = x^2\]

Example:

square([2, 3, 4]) = [4, 9, 16]

The storage type of square output depends upon the input storage type:

  • square(default) = default

  • square(row_sparse) = row_sparse

  • square(csr) = csr

Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L831

Parameters
  • data (NDArray) – The input array.

  • out (NDArray, optional) – The output NDArray to hold the result.

Returns

out – The output of this function.

Return type

NDArray or list of NDArrays