smartwell opened a new issue #15470: it maye be is a bug, how to explain
URL: https://github.com/apache/incubator-mxnet/issues/15470
 
 
   mxnet 1.5  ubuntu 16.04
   ```
   from mxnet import gluon
   from mxnet import nd
   from mxnet import autograd
   import mxnet.gluon.nn as nn
   
   class Generator(gluon.HybridBlock):
   
       def __init__(self, alloc_size=(5, 5), **kwargs):
           super(Generator, self).__init__(**kwargs)
   
   
           self.cnnblock = nn.HybridSequential()
   
           self.cnnblock.add(
               nn.Conv2D(32, kernel_size=3, strides=1, padding=1),
               nn.BatchNorm(),
               nn.LeakyReLU(0.2),
           )
           anchors = self._generate_anchors(alloc_size)
           self._key = 'anchor_1'
           self.anchors = self.params.get_constant(self._key, anchors)
   
       def _generate_anchors(self, alloc_size):
           return nd.random.uniform(shape=alloc_size)
   
       def hybrid_forward(self, F, x, anchors):
   
           if autograd.is_training():
               x = self.cnnblock(x)
   
               return x
           a = self.cnnblock(x)
   
           return a
   
   generator = Generator()
   generator.hybridize()
   generator.initialize()
   
   x = nd.random.uniform(shape=(1, 3, 512, 512))
   with autograd.train_mode():
       o = generator(x)
       print(o)
   ```
   
   error:
   `mxnet.gluon.parameter.DeferredInitializationError: Parameter 'conv0_weight' 
has not been initialized yet because initialization was deferred. Actual 
initialization happens during the first forward pass`
   
   if you delete all things about anchor ,it can run successfully

----------------------------------------------------------------
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

Reply via email to