leezu commented on a change in pull request #18413:
URL: https://github.com/apache/incubator-mxnet/pull/18413#discussion_r439575123



##########
File path: python/mxnet/gluon/block.py
##########
@@ -542,61 +460,60 @@ def load_parameters(self, filename, ctx=None, 
allow_missing=False,
                     raise ValueError(err_msg)
         else:
             loaded = ndarray.load(filename)
-        params = self._collect_params_with_prefix()
-        if not loaded and not params:
-            return
 
-        if not any('.' in i for i in loaded.keys()):
-            # legacy loading
-            loaded = None  # This should be changed to `del loaded` when 
dropping Python 2
-            self.collect_params().load(
-                filename, ctx, allow_missing, ignore_extra, self.prefix,
-                cast_dtype=cast_dtype, dtype_source=dtype_source)
+        if not loaded:
             return
+        self.load_dict(loaded, filename, ctx, allow_missing, ignore_extra, 
cast_dtype, dtype_source)
+
+    def load_dict(self, param_dict, filename=None, ctx=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
+        filename : str, default None

Review comment:
       When making `load_dict` a public function (instead of internal), it 
shouldn't take a `filename` argument. The use of filename here is just due to 
how you implement `load_parameters`. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to