MCPcopy
hub / github.com/lutzroeder/netron / deserialize_meta_func

Method deserialize_meta_func

source/python.js:20467–20487  ·  view source on GitHub ↗
(serialized_target)

Source from the content-addressed store, hash-verified

20465 ret.set('stack_trace', stack_trace);
20466 }
20467 const deserialize_meta_func = (serialized_target) => {
20468 let module = null;
20469 let serialized_target_names = [];
20470 if (serialized_target.startsWith('torch.nn')) {
20471 module = torch.nn;
20472 serialized_target_names = serialized_target.split('.').slice(1);
20473 } else if (serialized_target.startsWith('torch')) {
20474 module = torch;
20475 serialized_target_names = serialized_target.split('.').slice(1);
20476 } else {
20477 return this.deserialize_operator(serialized_target);
20478 }
20479 let target = module;
20480 for (const name of serialized_target_names) {
20481 if (!builtins.hasattr(target, name)) {
20482 return serialized_target;
20483 }
20484 target = builtins.getattr(target, name);
20485 }
20486 return target;
20487 };
20488 const nn_module_stack_str = metadata.get('nn_module_stack');
20489 if (nn_module_stack_str) {
20490 const import_nn_module_stack = (key, path, ty) => {

Callers

nothing calls this directly

Calls 4

splitMethod · 0.80
deserialize_operatorMethod · 0.80
hasattrMethod · 0.80
getattrMethod · 0.45

Tested by

no test coverage detected