parameters: (self, *new_shape)
return_statement: return res.reshape(new_shape)
docstring: Changes shape and size of tensor in-place.
  
          If the shape of the new tensor is larger than the shape of the original tensor, the new tensor will be filled
          with 0. And if the shape of the new tensor is smaller than the shape of the original tensor, the new tensor is
          filled with the elements of the original tensor in order.
  
          Note:
              Instead of changing the size of the input tensor and returns nothing as in numpy,
              this method returns a new Tensor with the input size.
              Numpy argument `refcheck` is not supported.
  
          Args:
              new_shape (Union[ints, tuple of ints]): Shape of resized tensor.
  
          Returns:
              Tensor.
  
          Supported Platforms:
              ``Ascend`` ``GPU`` ``CPU``
  
          See also:
              :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
  
              :func:`mindspore.Tensor.repeat`: Repeat elements of a tensor.
  
          Examples:
              >>> import numpy as np
              >>> from mindspore import Tensor
              >>> x = Tensor(np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32))
              >>> y = x.resize(3, 3)
              >>> print(y)
              [[1. 2. 3.]
              [4. 5. 6.]
              [0. 0. 0.]]
              >>> y = x.resize(2, 2)
              >>> print(y)
              [[1. 2.]
              [3. 4.]]
docstring_summary: Changes shape and size of tensor in-place.
docstring_tokens: Changes shape and size of tensor in - place .
function: def resize(self, *new_shape):
          """
          Changes shape and size of tensor in-place.
  
          If the shape of the new tensor is larger than the shape of the original tensor, the new tensor will be filled
          with 0. And if the shape of the new tensor is smaller than the shape of the original tensor, the new tensor is
          filled with the elements of the original tensor in order.
  
          Note:
              Instead of changing the size of the input tensor and returns nothing as in numpy,
              this method returns a new Tensor with the input size.
              Numpy argument `refcheck` is not supported.
  
          Args:
              new_shape (Union[ints, tuple of ints]): Shape of resized tensor.
  
          Returns:
              Tensor.
  
          Supported Platforms:
              ``Ascend`` ``GPU`` ``CPU``
  
          See also:
              :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
  
              :func:`mindspore.Tensor.repeat`: Repeat elements of a tensor.
  
          Examples:
              >>> import numpy as np
              >>> from mindspore import Tensor
              >>> x = Tensor(np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32))
              >>> y = x.resize(3, 3)
              >>> print(y)
              [[1. 2. 3.]
              [4. 5. 6.]
              [0. 0. 0.]]
              >>> y = x.resize(2, 2)
              >>> print(y)
              [[1. 2.]
              [3. 4.]]
          """
          if not new_shape:
              return self
          if len(new_shape) == 1:
              if isinstance(new_shape[0], tuple):
                  new_shape = new_shape[0]
          flattened = self.ravel()
          cur_size = flattened.size
          new_size = tensor_operator_registry.get('shape_mul')(new_shape)
          diff_size = new_size - cur_size
          if diff_size > 0:
              pad_val = tensor_operator_registry.get('fill')(self.dtype, (diff_size,), 0)
              res = tensor_operator_registry.get('concatenate')(0)((flattened, pad_val))
          else:
              res = flattened[:new_size]
          return res.reshape(new_shape)
function_tokens: def resize ( self , * new_shape ) : if not new_shape : return self if len ( new_shape ) == 1 : if isinstance ( new_shape [ 0 ] , tuple ) : new_shape = new_shape [ 0 ] flattened = self . ravel ( ) cur_size = flattened . size new_size = tensor_operator_registry . get ( 'shape_mul' ) ( new_shape ) diff_size = new_size - cur_size if diff_size > 0 : pad_val = tensor_operator_registry . get ( 'fill' ) ( self . dtype , ( diff_size , ) , 0 ) res = tensor_operator_registry . get ( 'concatenate' ) ( 0 ) ( ( flattened , pad_val ) ) else : res = flattened [ : new_size ] return res . reshape ( new_shape )