def multi_dot(x, name=None):
    '\n    Multi_dot is an operator that calculates multiple matrix multiplications.\n\n    Supports inputs of float16(only GPU support), float32 and float64 dtypes. This function does not\n    support batched inputs.\n\n    The input tensor in [x] must be 2-D except for the first and last can be 1-D.\n    If the first tensor is a 1-D vector of shape(n, ) it is treated as row vector\n    of shape(1, n), similarly if the last tensor is a 1D vector of shape(n, ), it\n    is treated as a column vector of shape(n, 1).\n\n    If the first and last tensor are 2-D matrix, then the output is also 2-D matrix,\n    otherwise the output is a 1-D vector.\n\n    Multi_dot will select the lowest cost multiplication order for calculation. The\n    cost of multiplying two matrices with shapes (a, b) and (b, c) is a * b * c.\n    Given matrices A, B, C with shapes (20, 5), (5, 100), (100, 10) respectively,\n    we can calculate the cost of different multiplication orders as follows:\n    - Cost((AB)C) = 20x5x100 + 20x100x10 = 30000\n    - Cost(A(BC)) = 5x100x10 + 20x5x10 = 6000\n\n    In this case, multiplying B and C first, then multiply A, which is 5 times faster\n    than sequential calculation.\n\n    Args:\n        x ([Tensor]): The input tensors which is a list Tensor.\n        name(str|None): A name for this layer(optional). If set None, the layer\n            will be named automatically.\n\n    Returns:\n        Tensor: The output Tensor.\n\n\n    Examples:\n\n    .. code-block:: python\n\n        import paddle\n        import numpy as np\n\n        # A * B\n        A_data = np.random.random([3, 4]).astype(np.float32)\n        B_data = np.random.random([4, 5]).astype(np.float32)\n        A = paddle.to_tensor(A_data)\n        B = paddle.to_tensor(B_data)\n        out = paddle.linalg.multi_dot([A, B])\n        print(out.numpy().shape)\n        # [3, 5]\n\n        # A * B * C\n        A_data = np.random.random([10, 5]).astype(np.float32)\n        B_data = np.random.random([5, 8]).astype(np.float32)\n        C_data = np.random.random([8, 7]).astype(np.float32)\n        A = paddle.to_tensor(A_data)\n        B = paddle.to_tensor(B_data)\n        C = paddle.to_tensor(C_data)\n        out = paddle.linalg.multi_dot([A, B, C])\n        print(out.numpy().shape)\n        # [10, 7]\n\n    '
    if paddle.in_dynamic_mode():
        return _C_ops.multi_dot(x)
    check_type(x, 'x', (list, tuple), 'multi_dot')
    for (id, item) in enumerate(x):
        check_variable_and_dtype(item, (('x[' + str(id)) + ']'), ['float16', 'float32', 'float64'], 'multi_dot')
        if (item.dtype != x[0].dtype):
            raise TypeError('All the Tensors in the input must have the same data type.')
    helper = LayerHelper('multi_dot', **locals())
    dtype = helper.input_dtype(input_param_name='x')
    out = helper.create_variable_for_type_inference(dtype)
    helper.append_op(type='multi_dot', inputs={'X': x}, outputs={'Out': out})
    return out
Multi_dot is an operator that calculates multiple matrix multiplications.

Supports inputs of float16(only GPU support), float32 and float64 dtypes. This function does not
support batched inputs.

The input tensor in [x] must be 2-D except for the first and last can be 1-D.
If the first tensor is a 1-D vector of shape(n, ) it is treated as row vector
of shape(1, n), similarly if the last tensor is a 1D vector of shape(n, ), it
is treated as a column vector of shape(n, 1).

If the first and last tensor are 2-D matrix, then the output is also 2-D matrix,
otherwise the output is a 1-D vector.

Multi_dot will select the lowest cost multiplication order for calculation. The
cost of multiplying two matrices with shapes (a, b) and (b, c) is a * b * c.
Given matrices A, B, C with shapes (20, 5), (5, 100), (100, 10) respectively,
we can calculate the cost of different multiplication orders as follows:
- Cost((AB)C) = 20x5x100 + 20x100x10 = 30000
- Cost(A(BC)) = 5x100x10 + 20x5x10 = 6000

In this case, multiplying B and C first, then multiply A, which is 5 times faster
than sequential calculation.

Args:
    x ([Tensor]): The input tensors which is a list Tensor.
    name(str|None): A name for this layer(optional). If set None, the layer
        will be named automatically.

Returns:
    Tensor: The output Tensor.


Examples:

.. code-block:: python

    import paddle
    import numpy as np

    # A * B
    A_data = np.random.random([3, 4]).astype(np.float32)
    B_data = np.random.random([4, 5]).astype(np.float32)
    A = paddle.to_tensor(A_data)
    B = paddle.to_tensor(B_data)
    out = paddle.linalg.multi_dot([A, B])
    print(out.numpy().shape)
    # [3, 5]

    # A * B * C
    A_data = np.random.random([10, 5]).astype(np.float32)
    B_data = np.random.random([5, 8]).astype(np.float32)
    C_data = np.random.random([8, 7]).astype(np.float32)
    A = paddle.to_tensor(A_data)
    B = paddle.to_tensor(B_data)
    C = paddle.to_tensor(C_data)
    out = paddle.linalg.multi_dot([A, B, C])
    print(out.numpy().shape)
    # [10, 7]
def multi_dot(x, name=None):
    '\n    Multi_dot is an operator that calculates multiple matrix multiplications.\n\n    Supports inputs of float16(only GPU support), float32 and float64 dtypes. This function does not\n    support batched inputs.\n\n    The input tensor in [x] must be 2-D except for the first and last can be 1-D.\n    If the first tensor is a 1-D vector of shape(n, ) it is treated as row vector\n    of shape(1, n), similarly if the last tensor is a 1D vector of shape(n, ), it\n    is treated as a column vector of shape(n, 1).\n\n    If the first and last tensor are 2-D matrix, then the output is also 2-D matrix,\n    otherwise the output is a 1-D vector.\n\n    Multi_dot will select the lowest cost multiplication order for calculation. The\n    cost of multiplying two matrices with shapes (a, b) and (b, c) is a * b * c.\n    Given matrices A, B, C with shapes (20, 5), (5, 100), (100, 10) respectively,\n    we can calculate the cost of different multiplication orders as follows:\n    - Cost((AB)C) = 20x5x100 + 20x100x10 = 30000\n    - Cost(A(BC)) = 5x100x10 + 20x5x10 = 6000\n\n    In this case, multiplying B and C first, then multiply A, which is 5 times faster\n    than sequential calculation.\n\n    Args:\n        x ([Tensor]): The input tensors which is a list Tensor.\n        name(str|None): A name for this layer(optional). If set None, the layer\n            will be named automatically.\n\n    Returns:\n        Tensor: The output Tensor.\n\n\n    Examples:\n\n    .. code-block:: python\n\n        import paddle\n        import numpy as np\n\n        # A * B\n        A_data = np.random.random([3, 4]).astype(np.float32)\n        B_data = np.random.random([4, 5]).astype(np.float32)\n        A = paddle.to_tensor(A_data)\n        B = paddle.to_tensor(B_data)\n        out = paddle.linalg.multi_dot([A, B])\n        print(out.numpy().shape)\n        # [3, 5]\n\n        # A * B * C\n        A_data = np.random.random([10, 5]).astype(np.float32)\n        B_data = np.random.random([5, 8]).astype(np.float32)\n        C_data = np.random.random([8, 7]).astype(np.float32)\n        A = paddle.to_tensor(A_data)\n        B = paddle.to_tensor(B_data)\n        C = paddle.to_tensor(C_data)\n        out = paddle.linalg.multi_dot([A, B, C])\n        print(out.numpy().shape)\n        # [10, 7]\n\n    '
    if paddle.in_dynamic_mode():
        return _C_ops.multi_dot(x)
    check_type(x, 'x', (list, tuple), 'multi_dot')
    for (id, item) in enumerate(x):
        check_variable_and_dtype(item, (('x[' + str(id)) + ']'), ['float16', 'float32', 'float64'], 'multi_dot')
        if (item.dtype != x[0].dtype):
            raise TypeError('All the Tensors in the input must have the same data type.')
    helper = LayerHelper('multi_dot', **locals())
    dtype = helper.input_dtype(input_param_name='x')
    out = helper.create_variable_for_type_inference(dtype)
    helper.append_op(type='multi_dot', inputs={'X': x}, outputs={'Out': out})
    return out