首页 Paddle框架 帖子详情
想不通为什么使用paddle.fluid.dygraph.Conv2D出现了下面的问题
收藏
快速回复
Paddle框架 问答模型训练 159 0
想不通为什么使用paddle.fluid.dygraph.Conv2D出现了下面的问题
收藏
快速回复
Paddle框架 问答模型训练 159 0

parl版本2.1

paddle版本2.4.2

conv1 = Conv2D(num_channels=1, num_filters=20, filter_size=5, stride=1, padding=2, act='relu')

obs = parl.core.fluid.layers.data(name='obs', shape=[None, self.obs_dim], dtype='float32')

def value(self, obs):
x = self.conv1(obs)

 

如此使用时会有以下报错:

TypeError: The type of 'Filter' in operator conv2d should be one of [basestring(), str, Varibale] in python2, or one of [str, bytes, Variable] in python3.but received : Parameter containing:
Tensor(shape=[20, 1, 5, 5], dtype=float32, place=Place(cpu), stop_gradient=False,
[[[[ 0.47243306, -0.20335183, -0.09854988, -0.01032914, 0.08503843],
[ 0.15641759, 0.17344509, -0.03785811, -0.42239943, 0.27567264],
[ 0.35463092, -0.11124908, 0.28107727, 0.13953362, 0.66362083],
[-0.07623158, 0.27313450, 0.09171128, -0.16410473, -0.02793298],
[-0.39371279, 0.60560465, 0.08527652, -0.12554359, -0.39569846]]],……

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