mindspore.ops.Cross

class mindspore.ops.Cross(dim=- 65530)[source]

Returns the cross product of vectors in dimension dim of x1 and x2.

Warning

This is an experimental API that is subject to change or deletion.

Refer to mindspore.ops.cross() for more details.

Parameters

dim (int) – Spefcified dim along which to cumpute cross product with. Default: -65530.

Inputs:
  • x1 (Tensor) - Input Tensor.

  • x2 (Tensor) - Another input Tensor, must have the same shape and the same type as x1, and the size of their dim dimension should be 3.

Outputs:

Tensor, has the same shape and type as inputs.

Supported Platforms:

Ascend CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> from mindspore.common import dtype as mstype
>>> import mindspore.ops as ops
>>> cross = ops.Cross(dim = 0)
>>> x1 = Tensor([1, 2, 3], mstype.int8)
>>> x2 = Tensor([1, 2, 3], mstype.int8)
>>> output = cross(x1, x2)
>>> print(output)
[0 0 0]