Cross
cross(input, other, dim=-1, out=NULL) -> Tensor
Returns the cross product of vectors in dimension dim
of input
and other
.
input
and other
must have the same size, and the size of their
dim
dimension should be 3.
If dim
is not given, it defaults to the first dimension found with the
size 3.
Examples
if (torch_is_installed()) {
a = torch_randn(c(4, 3))
a
b = torch_randn(c(4, 3))
b
torch_cross(a, b, dim=2)
torch_cross(a, b)
}
#> torch_tensor
#> -1.0034 -0.4132 -3.8712
#> -1.6889 1.9374 2.2741
#> 1.7125 -0.7639 -0.0354
#> 0.4060 0.7154 1.5142
#> [ CPUFloatType{4,3} ]