Questions tagged «keras-rl»

1
TypeError:len对于符号张量没有很好的定义。(activation_3 / Identity:0)请致电`x.shape`而不是`len(x)`以获得形状信息
我正在尝试在openAI体育馆的一场比赛中实现DQL模型。但这给了我以下错误。 TypeError:len对于符号张量没有很好的定义。(activation_3 / Identity:0)请致电,x.shape而不是len(x) 索取形状信息。 创建体育馆环境: ENV_NAME = 'CartPole-v0' env = gym.make(ENV_NAME) np.random.seed(123) env.seed(123) nb_actions = env.action_space.n 我的模型如下所示: model = Sequential() model.add(Flatten(input_shape=(1,) + env.observation_space.shape)) model.add(Dense(16)) model.add(Activation('relu')) model.add(Dense(nb_actions)) model.add(Activation('linear')) print(model.summary()) 通过keral-rl将模型拟合到DQN模型,如下所示: policy = EpsGreedyQPolicy() memory = SequentialMemory(limit=50000, window_length=1) dqn = DQNAgent(model=model, nb_actions=nb_actions, memory=memory, nb_steps_warmup=10, target_model_update=0.001, policy=policy) dqn.compile(Adam(lr=1e-3), metrics=['mse', 'mae']) dqn.fit(env, nb_steps=5000, …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.