mindspore.mint.cross
- mindspore.mint.cross(input, other, dim=None)[source]
Compute the cross product of two input tensors along the specified dimension.
Note
input and other must have the same shape, and the size of their dim dimension should be 3. If dim is not specified, it is set to be the first dimension found with the size 3.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> input = mindspore.tensor([[1, 2, 3], [1, 2, 3], [1, 2, 3]]) >>> other = mindspore.tensor([[4, 5, 6], [4, 5, 6], [4, 5, 6]]) >>> mindspore.mint.cross(input, other) Tensor(shape=[3, 3], dtype=Int64, value= [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) >>> mindspore.mint.cross(input, other, dim=1) Tensor(shape=[3, 3], dtype=Int64, value= [[-3, 6, -3], [-3, 6, -3], [-3, 6, -3]])