mxfusion.util.serialization¶
Members¶
-
class
mxfusion.util.serialization.
ModelComponentEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)¶ Bases:
json.encoder.JSONEncoder
-
default
(obj)¶ Serializes a ModelComponent object. Note: does not serialize the successor attribute as it isn’t necessary for serialization.
-
-
class
mxfusion.util.serialization.
ModelComponentDecoder
(*args, **kwargs)¶ Bases:
json.decoder.JSONDecoder
-
object_hook
(obj)¶ Reloads a ModelComponent object. Note: does not reload the successor attribute as it isn’t necessary for serialization.
-
-
mxfusion.util.serialization.
load_json_file
(target_file, decoder=None)¶
-
mxfusion.util.serialization.
load_json_from_zip
(zip_filename, target_file, decoder=None)¶ Utility function that loads a json file from inside a zip file without unzipping the zip file and returns the loaded json as a dictionary. :param encoder: optional. a JSONDecoder class to pass to the json.load function for loading back in the dict.
-
mxfusion.util.serialization.
make_numpy
(obj)¶ Utility function that takes a dictionary of numpy or MXNet arrays and returns a dictionary of numpy arrays. Used to standardize serialization.
-
mxfusion.util.serialization.
load_parameters
(npz_filename, zip_file, context=None)¶ Helper function to load the parameters from a npz file directly into a dictionary as mxnet arrays.