parameters: (self, param_dict, device=None, allow_missing=False,
                    ignore_extra=False, cast_dtype=False, dtype_source="current")
docstring: Load parameters from dict
  
          Parameters
          ----------
          param_dict : dict
              Dictionary containing model parameters
          device : Device, optional
              Device context on which the memory is allocated. Default is
              `mxnet.device.current_device()`.
          allow_missing : bool, default False
              Whether to silently skip loading parameters not represented in the file.
          ignore_extra : bool, default False
              Whether to silently ignore parameters from the file that are not
              present in this dict.
          cast_dtype : bool, default False
              Cast the data type of the NDArray loaded from the checkpoint to the dtype
              provided by the Parameter if any
          dtype_source : str, default 'current'
              must be in {'current', 'saved'}
              Only valid if cast_dtype=True, specify the source of the dtype for casting
              the parameters
docstring_summary: Load parameters from dict
docstring_tokens: Load parameters from dict
function: def load_dict(self, param_dict, device=None, allow_missing=False,
                    ignore_extra=False, cast_dtype=False, dtype_source="current"):
          """Load parameters from dict
  
          Parameters
          ----------
          param_dict : dict
              Dictionary containing model parameters
          device : Device, optional
              Device context on which the memory is allocated. Default is
              `mxnet.device.current_device()`.
          allow_missing : bool, default False
              Whether to silently skip loading parameters not represented in the file.
          ignore_extra : bool, default False
              Whether to silently ignore parameters from the file that are not
              present in this dict.
          cast_dtype : bool, default False
              Cast the data type of the NDArray loaded from the checkpoint to the dtype
              provided by the Parameter if any
          dtype_source : str, default 'current'
              must be in {'current', 'saved'}
              Only valid if cast_dtype=True, specify the source of the dtype for casting
              the parameters
          """
          if isinstance(param_dict.get('filename'), str):
              # pass from load_parameters
              filename = param_dict['filename']
              param_dict = param_dict['params']
          else:
              filename = None
          params = self.collect_params()
          error_str = "file: %s" % (filename) if filename else "param_dict"
          loaded = {k[4:] if k.startswith('arg:') or k.startswith('aux:') else k: v \
                    for k, v in param_dict.items()}
  
          if not allow_missing:
              params_inv = defaultdict(list)
              for k, v in params.items():
                  params_inv[v].append(k)
  
              for name, param in params.items():
                  assert any(p in loaded for p in params_inv[param]), \
                      "Parameter '%s' is missing in '%s', which contains parameters: %s. " \
                      "Set allow_missing=True to ignore missing parameters."%(
                          name, error_str, _brief_print_list(loaded.keys()))
  
          if device is None:
              device = _device.current_device()
          for name in loaded:
              if not ignore_extra and name not in params:
                  raise ValueError(
                      "Parameter '%s' loaded from '%s' is not present in Dict, " \
                      "which contains parameters %s. Set ignore_extra=True to ignore. "%(
                          name, error_str, _brief_print_list(params.keys())))
              if name in params:
                  param = loaded[name]
                  if isinstance(param, np.ndarray):
                      param = _mx_np.array(param) if is_np_array() else nd.array(param)
                  params[name]._load_init(param, device, cast_dtype=cast_dtype, dtype_source=dtype_source)
function_tokens: def load_dict ( self , param_dict , device = None , allow_missing = False , ignore_extra = False , cast_dtype = False , dtype_source = "current" ) : if isinstance ( param_dict . get ( 'filename' ) , str ) : # pass from load_parameters filename = param_dict [ 'filename' ] param_dict = param_dict [ 'params' ] else : filename = None params = self . collect_params ( ) error_str = "file: %s" % ( filename ) if filename else "param_dict" loaded = { k [ 4 : ] if k . startswith ( 'arg:' ) or k . startswith ( 'aux:' ) else k : v for k , v in param_dict . items ( ) } if not allow_missing : params_inv = defaultdict ( list ) for k , v in params . items ( ) : params_inv [ v ] . append ( k ) for name , param in params . items ( ) : assert any ( p in loaded for p in params_inv [ param ] ) , "Parameter '%s' is missing in '%s', which contains parameters: %s. " "Set allow_missing=True to ignore missing parameters." % ( name , error_str , _brief_print_list ( loaded . keys ( ) ) ) if device is None : device = _device . current_device ( ) for name in loaded : if not ignore_extra and name not in params : raise ValueError ( "Parameter '%s' loaded from '%s' is not present in Dict, " "which contains parameters %s. Set ignore_extra=True to ignore. " % ( name , error_str , _brief_print_list ( params . keys ( ) ) ) ) if name in params : param = loaded [ name ] if isinstance ( param , np . ndarray ) : param = _mx_np . array ( param ) if is_np_array ( ) else nd . array ( param ) params [ name ] . _load_init ( param , device , cast_dtype = cast_dtype , dtype_source = dtype_source )