torch.float_power
- torch.float_power(input, exponent, *, out=None) → Tensor
Raises
inputto the power of, elementwise, in double precision. If neither input is complex returns a tensor, and if one or more inputs is complex returns a tensor.
Raises input to the power of , elementwise, in double precision.
If neither input is complex returns a tensor,
and if one or more inputs is complex returns a tensor.
torch.float64torch.complex128Example:
>>> a = torch.randint(10, (4,))
>>> a
tensor([6, 4, 7, 1])
>>> torch.float_power(a, 2)
tensor([36., 16., 49., 1.], dtype=torch.float64)
>>> a = torch.arange(1, 5)
>>> a
tensor([ 1, 2, 3, 4])
>>> exp = torch.tensor([2, -3, 4, -5])
>>> exp
tensor([ 2, -3, 4, -5])
>>> torch.float_power(a, exp)
tensor([1.0000e+00, 1.2500e-01, 8.1000e+01, 9.7656e-04], dtype=torch.float64)