mxnet.np.square¶
-
square
(x, out=None, **kwargs)¶ Return the element-wise square of the input.
- Parameters
x (ndarray or scalar) – The values whose squares are required.
out (ndarray or None, optional) – A location into which the result is stored. If provided, it must have the same shape as the input. If not provided or None, a freshly-allocated array is returned.
- Returns
y – Output array is same shape and type as x. This is a scalar if x is a scalar.
- Return type
ndarray or scalar
Examples
>>> np.square(2.) 4.0 >>> x = np.array([1, 2., -1]) >>> np.square(x) array([1., 4., 1.])
Note
The output ndarray has the same device as the input ndarray. This function differs from the original numpy.square in the following aspects:
Only support ndarray and scalar now.
where argument is not supported.
Complex input is not supported.
Did this page help you?
Yes
No
Thanks for your feedback!