模型构建中关于使用layers.argmax()后模型报错
Created by: moranliuyu
- 版本、环境信息: 1)PaddlePaddle版本:1.5.0 2)CPU: 3)GPU: 4)系统环境:windows
- 模型信息
class ActorModel(Model):
def __init__(self, act_dim):
hid1_size = 400
hid2_size = 300
self.fc1 = layers.fc(size=hid1_size, act='relu')
self.fc2 = layers.fc(size=hid2_size, act='relu')
self.fc3 = layers.fc(size=act_dim, act='tanh')
def policy(self, obs):
hid1 = self.fc1(obs)
hid2 = self.fc2(hid1)
means = self.fc3(hid2)
means = layers.argmax(means, axis=1)
means = layers.unsqueeze(means, axes=[1])
return means.astype('float32')
cost = layers.reduce_mean(-1.0 * Q)
optimizer = fluid.optimizer.AdamOptimizer(self.actor_lr)
optimizer.minimize(cost, parameter_list=self.model.get_actor_params())
- 问题描述: 如上定义好模型(用了argmax())后,然后定义目标函数和优化函数,在进入到 optimizer.minimize(cost, parameter_list=self.model.get_actor_params())时系统报错: Process finished with exit code -1073741819 (0xC0000005)
请问:对于argmax()梯度反向传播的问题,是不是不能这么定义网络?