Fail to return model weights by using model.get_weights()
Created by: familyld
Version: paddlepaddle==1.6.2 parl==1.3.1
Code:
import parl
import paddle.fluid as fluid
from parl import layers
class CartpoleModel(parl.Model):
def __init__(self, act_dim):
hid_size = 8
self.fc1 = layers.fc(size=hid_size, act='relu')
self.fc2 = layers.fc(size=act_dim, act=None)
def value(self, obs):
h = self.fc1(obs)
Q = self.fc2(h)
return Q
action_dim = 2
model = CartpoleModel(act_dim=action_dim)
model.get_weights()
Error:
AssertionError: Cannot find fc.b_32 in scope. Perhaps you need to make the variable persistable by using var.persistable = True in your program.