Skip to content

allenact.utils.misc_utils#

[view_source]

NumpyJSONEncoder#

class NumpyJSONEncoder(json.JSONEncoder)

[view_source]

JSON encoder for numpy objects.

Based off the stackoverflow answer by Jie Yang here: https://stackoverflow.com/a/57915246. The license for this code is BY-SA 4.0.

HashableDict#

class HashableDict(dict)

[view_source]

A dictionary which is hashable so long as all of its values are hashable.

A HashableDict object will allow setting / deleting of items until the first time that __hash__() is called on it after which attempts to set or delete items will throw RuntimeError exceptions.