(meta_val, fx_node, args)
| 20401 | individual_output.meta.update(deserialized_metadata); |
| 20402 | }; |
| 20403 | const generate_getitems = (meta_val, fx_node, args) => { |
| 20404 | for (let idx = 0; idx < args.length; idx++) { |
| 20405 | const arg = args[idx]; |
| 20406 | if (arg instanceof torch._export.serde.schema.TensorArgument || |
| 20407 | arg instanceof torch._export.serde.schema.SymIntArgument || |
| 20408 | arg instanceof torch._export.serde.schema.SymFloatArgument) { |
| 20409 | generate_getitem(meta_val, fx_node, arg, idx); |
| 20410 | } else if (arg instanceof torch._export.serde.schema.Argument) { |
| 20411 | if (arg.type === 'as_tensor' || arg.type === 'as_sym_int' || arg.type === 'as_sym_float') { |
| 20412 | generate_getitem(meta_val, fx_node, arg.value, idx); |
| 20413 | } else if (arg.type === 'as_none') { |
| 20414 | const individual_output = this.graph.create_node( |
| 20415 | 'call_function', |
| 20416 | operator.getitem, |
| 20417 | new builtins.tuple([fx_node, idx]), |
| 20418 | null, |
| 20419 | 'as_none', |
| 20420 | ); |
| 20421 | meta_val.push(null); |
| 20422 | individual_output.meta.set('val', null); |
| 20423 | individual_output.meta.update(deserialized_metadata); |
| 20424 | } else if (Array.isArray(arg.value)) { |
| 20425 | const list_output = this.graph.create_node( |
| 20426 | 'call_function', |
| 20427 | operator.getitem, |
| 20428 | new builtins.tuple([fx_node, idx]), |
| 20429 | ); |
| 20430 | meta_val.push([]); |
| 20431 | generate_getitems(meta_val[meta_val.length - 1], list_output, arg.value); |
| 20432 | list_output.meta.update(deserialized_metadata); |
| 20433 | list_output.meta.set('val', meta_val[meta_val.length - 1]); |
| 20434 | } else { |
| 20435 | throw new python.Error(`Unsupported node output type '${arg.type}'.`); |
| 20436 | } |
| 20437 | } else if (Array.isArray(arg)) { |
| 20438 | const list_output = this.graph.create_node( |
| 20439 | 'call_function', |
| 20440 | operator.getitem, |
| 20441 | new builtins.tuple([fx_node, idx]), |
| 20442 | ); |
| 20443 | meta_val.push([]); |
| 20444 | generate_getitems(meta_val[meta_val.length - 1], list_output, arg); |
| 20445 | list_output.meta.update(deserialized_metadata); |
| 20446 | list_output.meta.set('val', meta_val[meta_val.length - 1]); |
| 20447 | } else { |
| 20448 | throw new python.Error(`Unsupported node output type '${arg}'.`); |
| 20449 | } |
| 20450 | } |
| 20451 | }; |
| 20452 | const meta_val = []; |
| 20453 | if (serialized_node.outputs.length === 1) { |
| 20454 | generate_getitems(meta_val, fx_node, serialized_node.outputs[0].value); |
nothing calls this directly
no test coverage detected