oneflow.square

oneflow.square()

Returns a new tensor with the square of the elements of input.

\[\text{out}_{i} = \sqrt{\text{input}_{i}}\]
Parameters

input – the input tensor.

>>> import oneflow as flow
>>> import numpy as np

>>> arr = np.array([1.0, 2.0, 3.0])
>>> input = flow.tensor(arr, dtype=flow.float32)
>>> output = flow.square(input).numpy()
>>> output
array([1., 4., 9.], dtype=float32)