parameters: (self, param, buffer_size)
docstring: This is a function to simplify the handling of parameter InternalStorages.
docstring_summary: This is a function to simplify the handling of parameter InternalStorages.
docstring_tokens: This is a function to simplify the handling of parameter InternalStorages .
function: def _param_storage(self, param, buffer_size):
          """
          This is a function to simplify the handling of parameter InternalStorages.
          """
          assert isinstance(buffer_size, int)
          value = np.zeros(
              buffer_size,
              dtype=np.float16) if Type.fp16.value == param.dtype else np.zeros(
                  buffer_size, dtype=np.float32)
          buffer = core.VarBase(value=value, place=core.CPUPlace())
  
          param_shape = param.shape
          origin_state = param.stop_gradient
          param.stop_gradient = True
          param.flatten_()
          param.stop_gradient = origin_state
          start, end = self._param2buffer[param.name][self._rank]
  
          # Copy the current param value
          tmp_var = core.VarBase(
              tensor=buffer._slice(0, param._numel()), place=core.CPUPlace())
          param_cpu = param.cpu()
          tmp_var.value().get_tensor().set(param_cpu.value().get_tensor(),
                                           core.CPUPlace())
          param.value().get_tensor()._set_dims(param_shape)
          param._clear()
  
          # Current rank param_storage
          if self._offload:
              param.fw_storage = core.VarBase(
                  buffer._slice(start, end),
                  core.CPUPlace(), "slice@" + param.name)
          else:
              param.fw_storage = core.VarBase(
                  buffer._slice(start, end), "slice@" + param.name)
          param.status = "part"
  
          # Updata optimizer master weights
          if param.dtype == Type.fp16.value and not self._offload:
              self._optim._master_weights[param.fw_storage.name] = paddle.cast(
                  param.fw_storage, Type.fp32.value)
function_tokens: def _param_storage ( self , param , buffer_size ) : assert isinstance ( buffer_size , int ) value = np . zeros ( buffer_size , dtype = np . float16 ) if Type . fp16 . value == param . dtype else np . zeros ( buffer_size , dtype = np . float32 ) buffer = core . VarBase ( value = value , place = core . CPUPlace ( ) ) param_shape = param . shape origin_state = param . stop_gradient param . stop_gradient = True param . flatten_ ( ) param . stop_gradient = origin_state start , end = self . _param2buffer [ param . name ] [ self . _rank ] # Copy the current param value tmp_var = core . VarBase ( tensor = buffer . _slice ( 0 , param . _numel ( ) ) , place = core . CPUPlace ( ) ) param_cpu = param . cpu ( ) tmp_var . value ( ) . get_tensor ( ) . set ( param_cpu . value ( ) . get_tensor ( ) , core . CPUPlace ( ) ) param . value ( ) . get_tensor ( ) . _set_dims ( param_shape ) param . _clear ( ) # Current rank param_storage if self . _offload : param . fw_storage = core . VarBase ( buffer . _slice ( start , end ) , core . CPUPlace ( ) , "slice@" + param . name ) else : param . fw_storage = core . VarBase ( buffer . _slice ( start , end ) , "slice@" + param . name ) param . status = "part" # Updata optimizer master weights if param . dtype == Type . fp16 . value and not self . _offload : self . _optim . _master_weights [ param . fw_storage . name ] = paddle . cast ( param . fw_storage , Type . fp32 . value )