aGiant commented on issue #17814: mxnet.gluon.data.vision.transforms.Normalize(mean=0.0, std=1.0) tuple issue within hybird_forward() URL: https://github.com/apache/incubator-mxnet/issues/17814#issuecomment-598112586 > For the first example, I noticed that you are defining both `hybrid_forward` and `forward` at the same time which is not supposed to work in this way. > > For the second example, you can use `get_constant` instead of `get` > > ```python > # self.scales = self.params.get('scales', shape=scales.shape, init=mx.init.Constant(scales.asnumpy()), differentiable=False) > > self.scales = self.params.get_constant(value=scales) > ``` Also tried HybridLambda layer to simplify the normalization, but got some very strange error ``` <ipython-input-21-6ebe4f1a4082> in <lambda>(F, x) 21 # self.normalizer = nn.LayerNorm() 22 with self.name_scope(): ---> 23 self.normalizer = nn.HybridLambda(lambda F,x: (x-min_vec)/max_vec) #NormalizationHybridLayer(min_vec, max_vec) 24 self.encoder = nn.HybridSequential(prefix='encoder_') 25 with self.encoder.name_scope(): ~/anaconda3/lib/python3.7/site-packages/mxnet/symbol/symbol.py in __sub__(self, other) 142 return _internal._MinusScalar(self, scalar=other) 143 else: --> 144 raise TypeError('type %s not supported' % str(type(other))) 145 146 def __isub__(self, other): TypeError: type <class 'mxnet.ndarray.ndarray.NDArray'> not supported ```
---------------------------------------------------------------- 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] With regards, Apache Git Services
