_tensor_pow
tensor_pow
¶
Computes x^power element-wise along tensor
.
This method can be used with Numpy data:
n = np.array([[1, 4, 6], [2.3, 0.5, 0]])
b = fe.backend.tensor_pow(n, 3.2) # [[1.0, 84.449, 309.089], [14.372, 0.109, 0]]
b = fe.backend.tensor_pow(n, 0.21) # [[1.0, 1.338, 1.457], [1.191, 0.865, 0]]
This method can be used with TensorFlow tensors:
t = tf.constant([[1, 4, 6], [2.3, 0.5, 0]])
b = fe.backend.tensor_pow(t, 3.2) # [[1.0, 84.449, 309.089], [14.372, 0.109, 0]]
b = fe.backend.tensor_pow(t, 0.21) # [[1.0, 1.338, 1.457], [1.191, 0.865, 0]]
This method can be used with PyTorch tensors:
p = torch.tensor([[1, 4, 6], [2.3, 0.5, 0]])
b = fe.backend.tensor_pow(p, 3.2) # [[1.0, 84.449, 309.089], [14.372, 0.109, 0]]
b = fe.backend.tensor_pow(p, 0.21) # [[1.0, 1.338, 1.457], [1.191, 0.865, 0]]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tensor |
Tensor
|
The input tensor. |
required |
power |
Union[int, float]
|
The power to which to raise the elements in the |
required |
Returns:
Type | Description |
---|---|
Tensor
|
The |
Raises:
Type | Description |
---|---|
ValueError
|
If |