mxnet错误解决Parameter 'dense3_weight' has not been initialized. Note that you should initialize parameters and create Trainer with Block.collect_params() instead of Block.params because the later does not include Parameters of nested child Blocks

Published on Aug. 22, 2023, 12:10 p.m.

mxnet错误如下

Parameter ‘dense3_weight’ has not been initialized. Note that you should initialize parameters and create Trainer with Block.collect_params() instead of Block.params because the later does not include Parameters of nested child Blocks

解决


net=nn.Dense(100, activation="relu")

# 使用默认方式初始化即可
net.initialize()

net(output)

核心原因就是因为没有初始化参数

参考
https://mxnet.apache.org/versions/1.6/api/python/docs/tutorials/getting-started/crash-course/2-nn.html

Tags: