mindspore.Tensor.frac
- Tensor.frac() Tensor
Calculates the fractional part of each element in self.
- Returns
Tensor, has the same shape and type as self.
- Raises
TypeError – If self is not a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor >>> input = Tensor(np.array([2, 4.2, -2.5]), mindspore.float16) >>> output = input.frac() >>> print(output) [ 0. 0.1992 -0.5 ]