baselines icon indicating copy to clipboard operation
baselines copied to clipboard

JSONOutputFormat has invalid ndarray conversion

Open mitar opened this issue 6 years ago • 2 comments

Current code:

    def writekvs(self, kvs):
        for k, v in sorted(kvs.items()):
            if hasattr(v, 'dtype'):
                v = v.tolist()
                kvs[k] = float(v)
        self.file.write(json.dumps(kvs) + '\n')
        self.file.flush()

When v has dtype, v is first converted to a list, but then tried to cast to a float.

Moreover, kvs is tried to be modified in place, which would also convert it for any later formaters.

mitar avatar Dec 06 '18 16:12 mitar

ouch... Thanks for pointing it out!

pzhokhov avatar Dec 19 '18 23:12 pzhokhov

Hi, I did a small fix and PR -> https://github.com/openai/baselines/pull/836

Kelvinson avatar Feb 26 '19 04:02 Kelvinson