tornadomeet commented on a change in pull request #9348: support regex of 
collect_params()
URL: https://github.com/apache/incubator-mxnet/pull/9348#discussion_r160302889
 
 

 ##########
 File path: python/mxnet/gluon/block.py
 ##########
 @@ -227,13 +228,37 @@ def params(self):
         children's parameters)."""
         return self._params
 
-    def collect_params(self):
+    def collect_params(self, select=['.*']):
         """Returns a :py:class:`ParameterDict` containing this 
:py:class:`Block` and all of its
-        children's Parameters."""
+        children's Parameters(default), also can returns the select 
:py:class:`ParameterDict`
+        which match some given regular expressions.
+
+        For example, collect the specified parameter 'conv1_weight' and 
'conv1_bias', can be putted
+        in list with full name of paramter::
+
+            model.collect_params(['conv1_weight', 'conv1_bias'])
+
+        or collect all paramters which their name ends with 'weight' or 
'bias', this can be done
+        using regular expressions::
+
+            model.collect_params(['.*weight', '.*bias'])
+
+        Parameters
+        ----------
+        select : list of str
+            List of name or regular expressions
 
 Review comment:
   Done.  
   
   another, if user has a python list to select parameter, like ['a', 'b', 
'c'], t hen he/she should first convert select='a|b|c' first using some code, 
any better way to avoid this?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to