(inp)
| 20252 | return [new builtins.tuple(args), kwargs]; |
| 20253 | } |
| 20254 | deserialize_input(inp) { |
| 20255 | const value = inp.value; |
| 20256 | const typ_ = inp.type; |
| 20257 | if (typ_ === 'as_none') { |
| 20258 | return null; |
| 20259 | } else if (typ_ === 'as_tensor') { |
| 20260 | return this.serialized_name_to_node.get(inp.as_tensor.name); |
| 20261 | } else if (typ_ === 'as_scalar_type') { |
| 20262 | return torch._export.serde.serialize.deserialize_scalar_type(inp.as_scalar_type); |
| 20263 | } else if (typ_ === 'as_memory_format') { |
| 20264 | return torch._export.serde.serialize._SERIALIZE_TO_TORCH_MEMORY_FORMAT[inp.as_memory_format]; |
| 20265 | } else if (typ_ === 'as_layout') { |
| 20266 | return torch._export.serde.serialize._SERIALIZE_TO_TORCH_LAYOUT[inp.as_layout]; |
| 20267 | } else if (typ_ === 'as_graph') { |
| 20268 | const context = this.save_graph_module(); |
| 20269 | context.__enter__(); |
| 20270 | this.deserialize_graph(value.graph); |
| 20271 | const submodule = torch.export.exported_program._create_graph_module_for_export(this.module, this.graph); |
| 20272 | context.__exit__(null, null, null); |
| 20273 | this.module.register_module(value.name, submodule); |
| 20274 | return this.graph.create_node('get_attr', value.name, null, null, value.name); |
| 20275 | } else if (typ_ === 'as_device') { |
| 20276 | return this.deserialize_device(inp.as_device); |
| 20277 | } else if (typ_ === 'as_int') { |
| 20278 | return inp.as_int; |
| 20279 | } else if (typ_ === 'as_float') { |
| 20280 | return inp.as_float; |
| 20281 | } else if (typ_ === 'as_bool') { |
| 20282 | return inp.as_bool; |
| 20283 | } else if (typ_ === 'as_string') { |
| 20284 | return inp.as_string; |
| 20285 | } else if (typ_ === 'as_sym_int') { |
| 20286 | return this.deserialize_sym_argument(inp.as_sym_int); |
| 20287 | } else if (typ_ === 'as_sym_float') { |
| 20288 | return this.deserialize_sym_argument(inp.as_sym_float); |
| 20289 | } else if (typ_ === 'as_sym_bool') { |
| 20290 | return this.deserialize_sym_argument(inp.as_sym_bool); |
| 20291 | } else if (Array.isArray(value)) { |
| 20292 | if (value.length === 0) { |
| 20293 | return []; |
| 20294 | } else if (typ_ === 'as_tensors') { |
| 20295 | const result = []; |
| 20296 | for (const arg of value) { |
| 20297 | if (!this.serialized_name_to_node.has(arg.name)) { |
| 20298 | throw new python.Error(`Unknown tensor '${arg.name}'.`); |
| 20299 | } |
| 20300 | result.push(this.serialized_name_to_node.get(arg.name)); |
| 20301 | } |
| 20302 | return result; |
| 20303 | } else if (typ_ === 'as_ints' || typ_ === 'as_floats' || typ_ === 'as_bools' || typ_ === 'as_strings') { |
| 20304 | return Array.from(value); |
| 20305 | } else if (typ_ === 'as_int_lists') { |
| 20306 | return value.map((dims) => Array.from(dims)); |
| 20307 | } else if (typ_ === 'as_float_lists') { |
| 20308 | return value.map((floats) => Array.from(floats)); |
| 20309 | } else if (typ_ === 'as_nested_tensors') { |
| 20310 | return value.map((inner_list) => inner_list.map((arg) => this.serialized_name_to_node.get(arg.name))); |
| 20311 | } else if (typ_ === 'as_sym_ints' || typ_ === 'as_sym_bools' || typ_ === 'as_sym_floats') { |
no test coverage detected