def cross(x, y, axis=None, name=None):
    '\n    Computes the cross product between two tensors along an axis.\n\n    Inputs must have the same shape, and the length of their axes should be equal to 3.\n    If `axis` is not given, it defaults to the first axis found with the length 3.\n\n    Args:\n        x (Tensor): The first input tensor.\n        y (Tensor): The second input tensor.\n        axis (int, optional): The axis along which to compute the cross product. It defaults to the first axis found with the length 3.\n        name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.\n\n    Returns:\n        Tensor. A Tensor with same data type as `x`.\n\n    Examples:\n        .. code-block:: python\n\n            import paddle\n\n            x = paddle.to_tensor([[1.0, 1.0, 1.0],\n                                  [2.0, 2.0, 2.0],\n                                  [3.0, 3.0, 3.0]])\n            y = paddle.to_tensor([[1.0, 1.0, 1.0],\n                                  [1.0, 1.0, 1.0],\n                                  [1.0, 1.0, 1.0]])\n\n            z1 = paddle.cross(x, y)\n            # [[-1. -1. -1.]\n            #  [ 2.  2.  2.]\n            #  [-1. -1. -1.]]\n\n            z2 = paddle.cross(x, y, axis=1)\n            # [[0. 0. 0.]\n            #  [0. 0. 0.]\n            #  [0. 0. 0.]]\n    '
    if in_dygraph_mode():
        return _C_ops.final_state_cross(x, y, axis)
    elif _in_legacy_dygraph():
        if (axis is not None):
            return _C_ops.cross(x, y, 'dim', axis)
        else:
            return _C_ops.cross(x, y)
    else:
        helper = LayerHelper('cross', **locals())
        out = helper.create_variable_for_type_inference(x.dtype)
        attrs = dict()
        attrs['dim'] = axis
        helper.append_op(type='cross', inputs={'X': x, 'Y': y}, outputs={'Out': out}, attrs=attrs)
        return out
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.

Args:
    x (Tensor): The first input tensor.
    y (Tensor): The second input tensor.
    axis (int, optional): The axis along which to compute the cross product. It defaults to the first axis found with the length 3.
    name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.

Returns:
    Tensor. A Tensor with same data type as `x`.

Examples:
    .. code-block:: python

        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)
        # [[-1. -1. -1.]
        #  [ 2.  2.  2.]
        #  [-1. -1. -1.]]

        z2 = paddle.cross(x, y, axis=1)
        # [[0. 0. 0.]
        #  [0. 0. 0.]
        #  [0. 0. 0.]]
def cross(x, y, axis=None, name=None):
    '\n    Computes the cross product between two tensors along an axis.\n\n    Inputs must have the same shape, and the length of their axes should be equal to 3.\n    If `axis` is not given, it defaults to the first axis found with the length 3.\n\n    Args:\n        x (Tensor): The first input tensor.\n        y (Tensor): The second input tensor.\n        axis (int, optional): The axis along which to compute the cross product. It defaults to the first axis found with the length 3.\n        name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.\n\n    Returns:\n        Tensor. A Tensor with same data type as `x`.\n\n    Examples:\n        .. code-block:: python\n\n            import paddle\n\n            x = paddle.to_tensor([[1.0, 1.0, 1.0],\n                                  [2.0, 2.0, 2.0],\n                                  [3.0, 3.0, 3.0]])\n            y = paddle.to_tensor([[1.0, 1.0, 1.0],\n                                  [1.0, 1.0, 1.0],\n                                  [1.0, 1.0, 1.0]])\n\n            z1 = paddle.cross(x, y)\n            # [[-1. -1. -1.]\n            #  [ 2.  2.  2.]\n            #  [-1. -1. -1.]]\n\n            z2 = paddle.cross(x, y, axis=1)\n            # [[0. 0. 0.]\n            #  [0. 0. 0.]\n            #  [0. 0. 0.]]\n    '
    if in_dygraph_mode():
        return _C_ops.final_state_cross(x, y, axis)
    elif _in_legacy_dygraph():
        if (axis is not None):
            return _C_ops.cross(x, y, 'dim', axis)
        else:
            return _C_ops.cross(x, y)
    else:
        helper = LayerHelper('cross', **locals())
        out = helper.create_variable_for_type_inference(x.dtype)
        attrs = dict()
        attrs['dim'] = axis
        helper.append_op(type='cross', inputs={'X': x, 'Y': y}, outputs={'Out': out}, attrs=attrs)
        return out