mindspore.Tensor.sin

Tensor.sin() Tensor

Computes sine of self element-wise.

\[output_i = \sin(self_i)\]
Returns

Tensor, has the same shape and dtype as self. The dtype of output is float32 when dtype of self is in [bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as self.

Raises

TypeError

  • CPU/GPU: If dtype of self is not float16, float32 or float64, complex64, complex128.

  • Ascend: If dtype of self is not bool, int8, uint8, int16, int32, int64, float16, float32 or float64, complex64, complex128.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> input = Tensor(np.array([0.62, 0.28, 0.43, 0.62]), mindspore.float32)
>>> output = Tensor.sin(input)  # input.sin()
>>> print(output)
[0.58103514 0.27635565 0.4168708 0.58103514]