acphile commented on a change in pull request #18619:
URL: https://github.com/apache/incubator-mxnet/pull/18619#discussion_r453431154



##########
File path: python/mxnet/gluon/block.py
##########
@@ -1573,29 +1534,31 @@ def __init__(self, outputs, inputs, params=None):
 
         arg_types, aux_types = _infer_param_types(syms, out, arg_params, 
aux_params)
 
-        def _set_params_attr(name, **kwargs):
-            if params.get(name) is None:
-                param = Parameter(**kwargs)
-                param._name = name
-            else:
-                param = params[name]
-                param._check_and_setattr(**kwargs)
-            if self._structured_named:
-                lis = structure[name]
-                assert len(lis) > 0, "Can not find structured name for 
Parameter %s in 'params'. " \
-                    "Please check 'params' is complete!" % name
-                for structured_name in lis:
-                    self._reg_params[structured_name] = param
-            else:
-                self._reg_params[name] = param
+        if params is None:
+            params = {}
+        unused_params = set(params.keys()) - set(arg_params) - set(aux_params)
+        if len(unused_params) > 0:
+            raise ValueError('{} params are unused by the 
model.'.format(unused_params))

Review comment:
       I‘m worried about this case: when a model's forward returns multiple 
outputs and we want to build SymbolBlock using one of the outputs, it may be 
difficult for users to precisely pass the intended parameters which the output 
uses.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to