for dim, value in data["dims"].items():
layer.set_dim(dim, value)
for param in data["params"]:
layer.set_param(param["name"], param["value"])
for i, shim_bytes in enumerate(data["shims"]):
layer.shims[i].from_bytes(shim_bytes)
for name, ref_i in data["refs"].items():
if ref_i is None:
After Change
if len(msg["nodes"]) != len(nodes):
raise ValueError("Cannot deserialize model: mismatched structure.")
for i, node in enumerate(nodes):
info = msg["nodes"][i]
node.name = info["name"]
for dim, value in info["dims"].items():
node.set_dim(dim, value)
for ref, ref_index in info["refs"].items():
if ref_index is None:
node.set_ref(ref, None)
else:
node.set_ref(ref, nodes[ref_index])
for attr, value in msg["attrs"][i].items():
default_value = node.get_attr(attr)
loaded_value = deserialize_attr(default_value, value, attr, node)
node.set_attr(attr, loaded_value)