首页 Paddle框架 帖子详情
参数应该为type Parameter or None, but got 'Tensor'
收藏
快速回复
Paddle框架 问答模型训练 368 0
参数应该为type Parameter or None, but got 'Tensor'
收藏
快速回复
Paddle框架 问答模型训练 368 0

这行出错了: m.bias=paddle.full(m.bias.shape, fill_value=0, dtype='float32')

包报错:assignment to parameter 'bias' should be of type Parameter or None, but got 'Tensor'

这是bias: Parameter containing:
Tensor(shape=[60], dtype=float32, place=Place(cpu), stop_gradient=False,
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0.])

自己测试结果:

bias=x=paddle.ones([5],dtype='float32')
bias=paddle.full(bias.shape, fill_value=0.2, dtype='float32')

Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
[1., 1., 1., 1., 1.])
Tensor(shape=[5], dtype=float32, place=Place(cpu), stop_gradient=True,
[0.20000000, 0.20000000, 0.20000000, 0.20000000, 0.20000000])

看过去也没问题,那问题在哪呢

0
收藏
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户