def _encapsulate(self): return { 'activation_stats': convert_keys_to_str(self._activation_stats), 'filter_stats': convert_keys_to_str(self._filter_stats), 'min_qsnr': self._min_qsnr, 'force_width': self._force_width }
def dump_state(G: NNGraph, include_parameters=True, state_path=None, extra=None): parameters = get_parameters(G) if include_parameters else {} if state_path is not None: graph_base, _ = os.path.splitext(state_path) if os.path.isdir(graph_base): graph_base = os.path.join( graph_base, os.path.basename(G.graph_identity.filename)) else: graph_base, _ = os.path.splitext(G.graph_identity.filename) info_state = { 'identity': G.graph_identity.identity, 'info': convert_keys_to_str(G.info), 'node_options': convert_keys_to_str(G.node_options), 'load_parameters': include_parameters, 'name': G.name, 'extra': extra } state_filename = graph_base + STATE_EXTENSION LOG.info("dumping graph state to %s", state_filename) with open(state_filename, "w") as json_fp: json.dump(info_state, json_fp, indent=2, cls=JsonSerializableStateEncoder) if include_parameters: pickle_filename = graph_base + ARRS_EXTENSION LOG.info("dumping tensors to %s", pickle_filename) with open(pickle_filename, "wb") as param_fp: pickle.dump(parameters, param_fp)
def _encapsulate(self): return convert_keys_to_str(self._init)
def _encapsulate(self): return { 'activation_stats': convert_keys_to_str(self._activation_stats), 'force_width': self._force_width, 'quantized_dimension': self._quantized_dimension }