0

这是我的功能:

scores = dqn.test(env, nb_episodes=1, visualize=False, verbose=1, callbacks=[CustomCallback()])

我从https://www.tensorflow.org/guide/keras/custom_callback

我有一个用于训练我的 DQN 的标准 openai 健身房环境:

class TestEnv(Env):

def __init__(self):
    ...
def step(self, action):
    ...     
    return sum(self.state.values()), reward, done, info

def render(self):
    pass

def reset(self):
    ...       
    return sum(self.state.values())

如果可能的话,我想从回调类中绘制sum(self.state.values())的值。我想了解如何将这些值传递给方法中的回调类:

class CustomCallback(keras.callbacks.Callback):
   ...

def on_epoch_end(self, epoch, logs=None):
    keys = list(logs.keys())
    print("End epoch {} of training; got log keys: {}".format(epoch, keys))
    print( **sum(self.state.values())**)
4

0 回答 0