Returns the cross product of vectors in dimension dim of x and other.
x and other must have the same size, and the size of their dim dimension
should be 3.
tch_cross(x, other, dim = -1)
| x | tensor object | 
|---|---|
| other | the second input tensor | 
| dim | the dimension to take the cross-product in. | 
If dim is not given, it defaults to the first dimension found with the size 3.
a <- tensor(matrix(runif(12), ncol = 3)) b <- tensor(matrix(runif(12), ncol = 3)) tch_cross(a, b, dim=1)#> tensor #> -0.0083 -0.0708 0.4435 #> -0.0581 -0.1184 0.1445 #> -0.2961 -0.5195 0.4801 #> -0.7192 0.1908 0.1633 #> [ Variable[CPUFloatType]{4,3} ]tch_cross(a, b)#> tensor #> -0.0083 -0.0708 0.4435 #> -0.0581 -0.1184 0.1445 #> -0.2961 -0.5195 0.4801 #> -0.7192 0.1908 0.1633 #> [ Variable[CPUFloatType]{4,3} ]