jmacglashan commented on issue #9822: gluon HybridBlock wrapper of constant 
nd.array, is it possible?
   @feevos I haven't tried your code yet, but I think the issue is that your 
`hybrid_forward` does not have **kwargs nor an argument named the same as the 
   Mxnet hybrid blocks will push parameters as inputs to the hybrid forward 
method (I believe because this is how it resolves passing them in as variable 
symbols when it compiles a graph). So you should add that argument and get the 
"constant" parameter from the function arguments.
   For example, consider the `hybrid_forward` definition of the `Dense` block 
in Mxnet:
    def hybrid_forward(self, F, x, weight, bias=None):
           if bias is None:
               act = F.FullyConnected(x, weight, no_bias=True, 
               act = F.FullyConnected(x, weight, bias, num_hidden=self._units,
           if self.act is not None:
               act = self.act(act)
           return act
   Note that the method receives `weight` and `bias` as arguments. These are 
are defined as parameters inside the Block's ParameterDict and the forward 
operation of the HybridBlock will automatically push all parameters to 
   So you should change your code to be:
   def hybrid_forward(self,F,_x, Bijkl):
   And then you don't need to pull it from the parameter dict in the hybrid 
forward, just use the arg.

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:

With regards,
Apache Git Services

Reply via email to