[GitHub] chinakook commented on a change in pull request #9492: fix print_summary bug and add groups of convolution

2018-02-17 Thread GitBox
chinakook commented on a change in pull request #9492: fix print_summary bug 
and add groups of convolution
URL: https://github.com/apache/incubator-mxnet/pull/9492#discussion_r168936777
 
 

 ##
 File path: python/mxnet/visualization.py
 ##
 @@ -134,20 +134,26 @@ def print_layer_summary(node, out_shape):
 pre_filter = pre_filter + int(shape[0])
 cur_param = 0
 if op == 'Convolution':
-if ("no_bias" in node["attrs"]) and int(node["attrs"]["no_bias"]):
-cur_param = pre_filter * int(node["attrs"]["num_filter"])
+if "no_bias" in node["attrs"] and node["attrs"]["no_bias"] == 
'True':
+num_group = int(node["attrs"]["num_group"]) if \
+   "num_group" in node["attrs"] else 1
 
 Review comment:
   Ok


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


With regards,
Apache Git Services


[GitHub] chinakook commented on a change in pull request #9492: fix print_summary bug and add groups of convolution

2018-02-07 Thread GitBox
chinakook commented on a change in pull request #9492: fix print_summary bug 
and add groups of convolution
URL: https://github.com/apache/incubator-mxnet/pull/9492#discussion_r166542757
 
 

 ##
 File path: python/mxnet/visualization.py
 ##
 @@ -134,17 +134,23 @@ def print_layer_summary(node, out_shape):
 pre_filter = pre_filter + int(shape[0])
 cur_param = 0
 if op == 'Convolution':
-if ("no_bias" in node["attrs"]) and int(node["attrs"]["no_bias"]):
-cur_param = pre_filter * int(node["attrs"]["num_filter"])
+if ("no_bias" in node["attrs"]) and node["attrs"]["no_bias"] == 
'True':
+num_group = int(node["attrs"]["num_group"]) if \
+   ("num_group" in node["attrs"]) else 1
+cur_param = (pre_filter * int(node["attrs"]["num_filter"])) \
+   // num_group
 for k in _str2tuple(node["attrs"]["kernel"]):
 cur_param *= int(k)
 else:
-cur_param = pre_filter * int(node["attrs"]["num_filter"])
+num_group = int(node["attrs"]["num_group"]) if \
+   ("num_group" in node["attrs"]) else 1
+cur_param = (pre_filter * int(node["attrs"]["num_filter"])) \
+   // num_group
 for k in _str2tuple(node["attrs"]["kernel"]):
 cur_param *= int(k)
 cur_param += int(node["attrs"]["num_filter"])
 elif op == 'FullyConnected':
-if ("no_bias" in node["attrs"]) and int(node["attrs"]["no_bias"]):
+if ("no_bias" in node["attrs"]) and node["attrs"]["no_bias"] == 
'True':
 
 Review comment:
   I see. Then use 
   ```python 
   node["attrs"]["no_bias"] == 'True' 
   ``` 
   back?


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


With regards,
Apache Git Services


[GitHub] chinakook commented on a change in pull request #9492: fix print_summary bug and add groups of convolution

2018-02-06 Thread GitBox
chinakook commented on a change in pull request #9492: fix print_summary bug 
and add groups of convolution
URL: https://github.com/apache/incubator-mxnet/pull/9492#discussion_r166496299
 
 

 ##
 File path: python/mxnet/visualization.py
 ##
 @@ -134,17 +134,23 @@ def print_layer_summary(node, out_shape):
 pre_filter = pre_filter + int(shape[0])
 cur_param = 0
 if op == 'Convolution':
-if ("no_bias" in node["attrs"]) and int(node["attrs"]["no_bias"]):
-cur_param = pre_filter * int(node["attrs"]["num_filter"])
+if ("no_bias" in node["attrs"]) and node["attrs"]["no_bias"] == 
'True':
+num_group = int(node["attrs"]["num_group"]) if \
+   ("num_group" in node["attrs"]) else 1
+cur_param = (pre_filter * int(node["attrs"]["num_filter"])) \
+   // num_group
 for k in _str2tuple(node["attrs"]["kernel"]):
 cur_param *= int(k)
 else:
-cur_param = pre_filter * int(node["attrs"]["num_filter"])
+num_group = int(node["attrs"]["num_group"]) if \
+   ("num_group" in node["attrs"]) else 1
+cur_param = (pre_filter * int(node["attrs"]["num_filter"])) \
+   // num_group
 for k in _str2tuple(node["attrs"]["kernel"]):
 cur_param *= int(k)
 cur_param += int(node["attrs"]["num_filter"])
 elif op == 'FullyConnected':
-if ("no_bias" in node["attrs"]) and int(node["attrs"]["no_bias"]):
+if ("no_bias" in node["attrs"]) and node["attrs"]["no_bias"] == 
'True':
 
 Review comment:
   I think i can replace bool(bool_str) with built-in function eval(bool_str).


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


With regards,
Apache Git Services