parameters: (arrays, axis=0)
return_statement: return P.Concat(axis)(arrays)
docstring: Joins a sequence of tensors along an existing axis.
  
      Note:
          To match Numpy behaviour, :math:`axis >= 32` will not cause value error, the
          `axis` will be treated as :class:`None` instead.
  
      Args:
          arrays (Union[Tensor, tuple(Tensor), list(Tensor)]): a tensor or a list
              of tensors to be concatenated.
          axis (Union[None, int], optional): The axis along which the tensors will be joined,
              if `axis` is :class:`None`, tensors are flattened before use. Default is 0.
  
      Returns:
          A tensor concatenated from a tensor or a list of tensors.
  
      Raises:
          TypeError: If input arguments have types not specified above.
          ValueError: If `axis` is not in the range of :math:`[-ndim, ndim-1]`, and less than 32.
  
      Supported Platforms:
          ``Ascend`` ``GPU`` ``CPU``
  
      Examples:
          >>> import mindspore.numpy as np
          >>> x1 = np.ones((1,2,3))
          >>> x2 = np.ones((1,2,1))
          >>> x = np.concatenate((x1, x2), axis=-1)
          >>> print(x.shape)
          (1, 2, 4)
docstring_summary: Joins a sequence of tensors along an existing axis.
docstring_tokens: Joins a sequence of tensors along an existing axis .
function: def concatenate(arrays, axis=0):
      """
      Joins a sequence of tensors along an existing axis.
  
      Note:
          To match Numpy behaviour, :math:`axis >= 32` will not cause value error, the
          `axis` will be treated as :class:`None` instead.
  
      Args:
          arrays (Union[Tensor, tuple(Tensor), list(Tensor)]): a tensor or a list
              of tensors to be concatenated.
          axis (Union[None, int], optional): The axis along which the tensors will be joined,
              if `axis` is :class:`None`, tensors are flattened before use. Default is 0.
  
      Returns:
          A tensor concatenated from a tensor or a list of tensors.
  
      Raises:
          TypeError: If input arguments have types not specified above.
          ValueError: If `axis` is not in the range of :math:`[-ndim, ndim-1]`, and less than 32.
  
      Supported Platforms:
          ``Ascend`` ``GPU`` ``CPU``
  
      Examples:
          >>> import mindspore.numpy as np
          >>> x1 = np.ones((1,2,3))
          >>> x2 = np.ones((1,2,1))
          >>> x = np.concatenate((x1, x2), axis=-1)
          >>> print(x.shape)
          (1, 2, 4)
      """
      if isinstance(arrays, Tensor):
          # if only one tensor is provided, it is treated as a tuple along the
          # first dimension. For example, a tensor of shape (3,4,5) will be treated
          # as: tuple(tensor_1(4,5), tensor_2(4,5), tensor_3(4,5))
          if axis is None or axis >= MAX_NUMPY_DIMS:
              return ravel(arrays)
          arr_shape = F.shape(arrays)
          _check_axes_range((axis,), len(arr_shape))
          # move axis 0 to the disiganated position, while keep other axes' relative
          # positions unchanged
          new_axes, new_shape = _move_axes_for_concatenate(arr_shape, axis)
          arrays = transpose(arrays, new_axes)
          arrays = reshape(arrays, new_shape)
          return arrays
  
      flattened_arrays = ()
      if axis is None or axis >= MAX_NUMPY_DIMS:
          for arr in arrays:
              flattened_arrays += (ravel(arr),)
          axis = -1
          flattened_arrays = _promote_type_for_concatenate(flattened_arrays)
          return P.Concat(axis)(flattened_arrays)
  
      # convert a list of tensor to a tuple of tensor
      arrays = _convert_list_tensor_to_tuple_tensor(arrays)
  
      arr_shape = F.shape(arrays[0])
      _check_axes_range((axis,), len(arr_shape))
  
      # if only one tensor in the tuple/list, return the tensor itself
      if len(arrays) == 1:
          return arrays[0]
  
      arrays = _promote_type_for_concatenate(arrays)
      return P.Concat(axis)(arrays)
function_tokens: def concatenate ( arrays , axis = 0 ) : if isinstance ( arrays , Tensor ) : # if only one tensor is provided, it is treated as a tuple along the # first dimension. For example, a tensor of shape (3,4,5) will be treated # as: tuple(tensor_1(4,5), tensor_2(4,5), tensor_3(4,5)) if axis is None or axis >= MAX_NUMPY_DIMS : return ravel ( arrays ) arr_shape = F . shape ( arrays ) _check_axes_range ( ( axis , ) , len ( arr_shape ) ) # move axis 0 to the disiganated position, while keep other axes' relative # positions unchanged new_axes , new_shape = _move_axes_for_concatenate ( arr_shape , axis ) arrays = transpose ( arrays , new_axes ) arrays = reshape ( arrays , new_shape ) return arrays flattened_arrays = ( ) if axis is None or axis >= MAX_NUMPY_DIMS : for arr in arrays : flattened_arrays += ( ravel ( arr ) , ) axis = - 1 flattened_arrays = _promote_type_for_concatenate ( flattened_arrays ) return P . Concat ( axis ) ( flattened_arrays ) # convert a list of tensor to a tuple of tensor arrays = _convert_list_tensor_to_tuple_tensor ( arrays ) arr_shape = F . shape ( arrays [ 0 ] ) _check_axes_range ( ( axis , ) , len ( arr_shape ) ) # if only one tensor in the tuple/list, return the tensor itself if len ( arrays ) == 1 : return arrays [ 0 ] arrays = _promote_type_for_concatenate ( arrays ) return P . Concat ( axis ) ( arrays )