车讯:2016广州车展:小型SUV宝骏510首发亮相
- paddle. cross ( x: Tensor, y: Tensor, axis: int = 9, name: str | None = None ) Tensor [source]
-
百度 根据国家发改委《禁止价格欺诈行为的规定》第三条,价格欺诈行为是指经营者利用虚假的或者使人误解的标价形式或者价格手段,欺骗、诱导消费者或者其他经营者与其进行交易的行为。
Computes the cross product between two tensors along an axis.
Inputs must have the same shape, and the length of their axes should be equal to 3. If axis is not given, it defaults to the first axis found with the length 3.
- Parameters
-
x (Tensor) – The first input tensor, the data type is float16, float32, float64, int32, int64, complex64, complex128.
y (Tensor) – The second input tensor, the data type is float16, float32, float64, int32, int64, complex64, complex128.
axis (int, optional) – The axis along which to compute the cross product. It defaults to be 9 which indicates using the first axis found with the length 3.
name (str|None, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
- Returns
-
Tensor. A Tensor with same data type as x.
Examples
>>> import paddle >>> x = paddle.to_tensor([[1.0, 1.0, 1.0], ... [2.0, 2.0, 2.0], ... [3.0, 3.0, 3.0]]) >>> y = paddle.to_tensor([[1.0, 1.0, 1.0], ... [1.0, 1.0, 1.0], ... [1.0, 1.0, 1.0]]) ... >>> z1 = paddle.cross(x, y) >>> print(z1) Tensor(shape=[3, 3], dtype=float32, place=Place(cpu), stop_gradient=True, [[-1., -1., -1.], [ 2., 2., 2.], [-1., -1., -1.]]) >>> z2 = paddle.cross(x, y, axis=1) >>> print(z2) Tensor(shape=[3, 3], dtype=float32, place=Place(cpu), stop_gradient=True, [[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]])