(object)
| 18993 | } |
| 18994 | } |
| 18995 | getOrCreateClassTypeForObject(object) { |
| 18996 | let cls = this._all_types[object.type_index]; |
| 18997 | const obj_type = this._module.object_types[object.type_index]; |
| 18998 | if (!cls) { |
| 18999 | const name = obj_type.type_name; |
| 19000 | if (name.startsWith('__torch__') || name.startsWith('torch.jit')) { |
| 19001 | cls = this._cu.get_class(new torch._C.QualifiedName(name)); |
| 19002 | if (!cls) { |
| 19003 | const torch = this._torch; |
| 19004 | cls = torch.ClassType.create(name, this._cu, true); |
| 19005 | this._cu.register_type(cls); |
| 19006 | } |
| 19007 | } else { |
| 19008 | // cls = c10::parseType(qn_str).cast<ClassType>(); |
| 19009 | } |
| 19010 | this._all_types[object.type_index] = cls; |
| 19011 | if (obj_type.type === torch.mobile.serialization.TypeType.CLASS_WITH_FIELD) { |
| 19012 | for (let i = 0; i < object.attrs.length; i++) { |
| 19013 | // const val = this._all_ivalues[object.attrs[i]]; |
| 19014 | cls.addAttribute(obj_type.attr_names[i] /*, null val.type(c10::DynamicType) */); |
| 19015 | } |
| 19016 | } |
| 19017 | } |
| 19018 | return cls; |
| 19019 | } |
| 19020 | }); |
| 19021 | this.registerType('torch.export.UnflattenedModule', class extends torch.nn.modules.module.Module { |
| 19022 | constructor(export_module, flat_args_adapter) { |
no test coverage detected