mxnet.gluon.parameter.DeferredInitializationError: Parameter 'XXX' has not been initialized yet.

  • 错误信息
mxnet.gluon.parameter.DeferredInitializationError: Parameter 'vggnet_fpn0_conv19_weight' has not been initialized yet because initializat
ion was deferred. Actual initialization happens during the first forward pass. Please pass one batch of data through the network before a
ccessing Parameters. You can also avoid deferred initialization by specifying in_units, num_features, etc., for network layers.
  • 解决方案
  • 检查Class的init中是否存在未在forward中使用的层的定义。
  • 对conv等层传递参数时,确认参数传递正确,可以加上参数名来进行传递,e.g.,
self.c3_out.add(Conv2dTranspose(channels=256,
                                kernel_size=4,
                                strides=4,
                                in_channels=64))

你可能感兴趣的:(深度学习之mxnet,mxnet,gluon,HybridBlock)