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
#> 0.2669 0.7449 0.7916
#> -0.1860 2.3654 -0.2624
#> -0.0787 0.3002 0.0702
#> 0.1014 -0.6320 0.9072
#> [ CPUFloatType{4,3} ]