sxjscience commented on a change in pull request #18199:
URL: https://github.com/apache/incubator-mxnet/pull/18199#discussion_r417932015
##########
File path: python/mxnet/gluon/nn/basic_layers.py
##########
@@ -820,26 +820,29 @@ class GroupNorm(HybridBlock):
"""
def __init__(self, num_groups=1, epsilon=1e-5, center=True, scale=True,
beta_initializer='zeros', gamma_initializer='ones',
- prefix=None, params=None):
+ in_channels=0, prefix=None, params=None):
super(GroupNorm, self).__init__(prefix=prefix, params=params)
self._kwargs = {'eps': epsilon, 'num_groups': num_groups, 'center':
center, 'scale': scale}
self._num_groups = num_groups
self._epsilon = epsilon
self._center = center
self._scale = scale
self.gamma = self.params.get('gamma', grad_req='write' if scale else
'null',
- shape=(num_groups,),
init=gamma_initializer,
+ shape=(in_channels,),
init=gamma_initializer,
allow_deferred_init=True)
self.beta = self.params.get('beta', grad_req='write' if center else
'null',
- shape=(num_groups,), init=beta_initializer,
+ shape=(in_channels,),
init=beta_initializer,
allow_deferred_init=True)
def hybrid_forward(self, F, data, gamma, beta):
norm_data = F.GroupNorm(data, gamma=gamma, beta=beta,
num_groups=self._num_groups, eps=self._epsilon)
Review comment:
I just realized one quick issue. Should we consider to move GroupNorm to
npx? Currently, the layer won’t be usable in the new numpy interface.
@zhreshold
----------------------------------------------------------------
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]