View source: R/gen-namespace.R
torch_pow | R Documentation |
Pow
torch_pow(self, exponent)
self |
(float) the scalar base value for the power operation |
exponent |
(float or tensor) the exponent value |
Takes the power of each element in input
with exponent
and
returns a tensor with the result.
exponent
can be either a single float
number or a Tensor
with the same number of elements as input
.
When exponent
is a scalar value, the operation applied is:
\mbox{out}_i = x_i^{\mbox{exponent}}
When exponent
is a tensor, the operation applied is:
\mbox{out}_i = x_i^{\mbox{exponent}_i}
When exponent
is a tensor, the shapes of input
and exponent
must be broadcastable .
self
is a scalar float
value, and exponent
is a tensor.
The returned tensor out
is of the same shape as exponent
The operation applied is:
\mbox{out}_i = \mbox{self} ^ {\mbox{exponent}_i}
if (torch_is_installed()) {
a = torch_randn(c(4))
a
torch_pow(a, 2)
exp <- torch_arange(1, 5)
a <- torch_arange(1, 5)
a
exp
torch_pow(a, exp)
exp <- torch_arange(1, 5)
base <- 2
torch_pow(base, exp)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.