MCPcopy
hub / github.com/tensorlayer/TensorLayer / load_and_assign_npz

Function load_and_assign_npz

tensorlayer/files/utils.py:2023–2047  ·  view source on GitHub ↗

Load model from npz and assign to a network. Parameters ------------- name : str The name of the `.npz` file. network : :class:`Model` The network to be assigned. Examples -------- - See ``tl.files.save_npz``

(name=None, network=None)

Source from the content-addressed store, hash-verified

2021
2022
2023def load_and_assign_npz(name=None, network=None):
2024 """Load model from npz and assign to a network.
2025
2026 Parameters
2027 -------------
2028 name : str
2029 The name of the `.npz` file.
2030 network : :class:`Model`
2031 The network to be assigned.
2032
2033 Examples
2034 --------
2035 - See ``tl.files.save_npz``
2036
2037 """
2038 if network is None:
2039 raise ValueError("network is None.")
2040
2041 if not os.path.exists(name):
2042 logging.error("file {} doesn't exist.".format(name))
2043 return False
2044 else:
2045 weights = load_npz(name=name)
2046 assign_weights(weights, network)
2047 logging.info("[*] Load {} SUCCESS!".format(name))
2048
2049
2050def save_npz_dict(save_list=None, name='model.npz'):

Callers

nothing calls this directly

Calls 2

load_npzFunction · 0.85
assign_weightsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…