IO utils for AtomicEmbeddings.
NumpyEncoder
Bases: JSONEncoder
Special json encoder for numpy types.
Source code in src/elementembeddings/utils/io.py
| class NumpyEncoder(json.JSONEncoder):
"""Special json encoder for numpy types."""
def default(self, obj):
"""Encode numpy types."""
if isinstance(obj, np.ndarray):
return obj.tolist()
return json.JSONEncoder.default(self, obj)
|
default(obj)
Encode numpy types.
Source code in src/elementembeddings/utils/io.py
| def default(self, obj):
"""Encode numpy types."""
if isinstance(obj, np.ndarray):
return obj.tolist()
return json.JSONEncoder.default(self, obj)
|