Google Colaboratoryで,DQNを行おうと以下のコードを実行しましたが,エラーが出てしまいます.
model = Sequential()
model.add(Flatten(input_shape=(1, ) + (84,)))
model.add(Dense(128, kernel_initializer='he_normal', activation='relu',kernel_regularizer=l2(0.01)))
model.add(Dense(128, kernel_initializer='he_normal', activation='relu',kernel_regularizer=l2(0.01)))
model.add(Dense(128, kernel_initializer='he_normal', activation='relu',kernel_regularizer=l2(0.01)))
model.add(Dense(3, activation='linear'))
print(model.summary())
memory = SequentialMemory(limit=200000, window_length=1)
policy = EpsGreedyQPolicy(eps = 0.1)
dqn = DQNAgent(model=model, nb_actions=3,gamma=0.99, memory=memory, nb_steps_warmup=100,target_model_update=1e-2, policy=policy)
dqn.compile(Adam(lr=1e-3), metrics=['mae'])
以下がエラーの内容です.(モデルの出力は省く)
TypeError Traceback (most recent call last)
<ipython-input-5-2ed7215a2a6d> in <module>()
3
----> 4 dqn = DQNAgent(model=model, nb_actions=3,gamma=0.99, memory=memory,nb_steps_warmup=100,target_model_update=1e-2, policy=policy)
5
6 dqn.compile(Adam(lr=1e-3), metrics=['mae'])
/tensorflow-1.15.2/python3.6/tensorflow_core/python/framework/ops.py in __len__(self)
739 raise TypeError("len is not well defined for symbolic Tensors. ({}) "
740 "Please call `x.shape` rather than `len(x)` for "
--> 741 "shape information.".format(self.name))
742
743 @staticmethod
TypeError: len is not well defined for symbolic Tensors. (dense_4/BiasAdd:0) Please call `x.shape` rather than `len(x)` for shape information.
環境はGoogle Colaboratoryを使用しています.
どなたか対処法が分かる方,ご教授お願い致します.
以上