tensor_ops {rTorch} | R Documentation |
Two tensor operations
Description
Two tensor operations
Usage
tensor_ops(a, b)
## S3 method for class 'torch.Tensor'
a ^ b
Arguments
a |
tensor |
b |
tensor |
Methods (by class)
-
torch.Tensor
: A tensor 'a' to the power of 'b'
Examples
## Not run:
a <- torch$Tensor(list(1, 1, 1))
b <- torch$Tensor(list(2, 2, 2))
s <- 2.0
a + b
b - a
a * b
a / s
a == b
a == a
a != a
x <- torch$Tensor(list(list(2, 2, 2), list(4, 4, 4)))
y <- torch$Tensor(list(list(1, 2, 1), list(3, 4, 5)))
x > y
x < y
x >= y
y <= x
diag <- torch$eye(3L)
zeros <- torch$zeros(c(3L, 3L))
diag & zeros
diag & diag
diag | diag
zeros | zeros
zeros & zeros
diag & zeros
diag | zeros
## End(Not run)
## Not run:
x <- torch$arange(1,11)
torch$pow(x, 2) # x^(2)
torch$pow(x, -2) # x^(1/2)
## End(Not run)
[Package rTorch version 0.4.2 Index]