(i)
| 20043 | } |
| 20044 | } |
| 20045 | deserialize_input_spec(i) { |
| 20046 | if (i.type === 'user_input') { |
| 20047 | return new torch.export.graph_signature.InputSpec( |
| 20048 | torch.export.graph_signature.InputKind.USER_INPUT, |
| 20049 | this.deserialize_argument_spec(i.user_input.arg), |
| 20050 | null); |
| 20051 | } else if (i.type === 'parameter') { |
| 20052 | return new torch.export.graph_signature.InputSpec( |
| 20053 | torch.export.graph_signature.InputKind.PARAMETER, |
| 20054 | new torch.export.graph_signature.TensorArgument(i.parameter.arg.name), |
| 20055 | i.parameter.parameter_name, |
| 20056 | ); |
| 20057 | } else if (i.type === 'buffer') { |
| 20058 | return new torch.export.graph_signature.InputSpec( |
| 20059 | torch.export.graph_signature.InputKind.BUFFER, |
| 20060 | new torch.export.graph_signature.TensorArgument(i.buffer.arg.name), |
| 20061 | i.buffer.buffer_name, |
| 20062 | i.buffer.persistent, |
| 20063 | ); |
| 20064 | } else if (i.type === 'tensor_constant') { |
| 20065 | return new torch.export.graph_signature.InputSpec( |
| 20066 | torch.export.graph_signature.InputKind.CONSTANT_TENSOR, |
| 20067 | new torch.export.graph_signature.TensorArgument(i.tensor_constant.arg.name), |
| 20068 | i.tensor_constant.tensor_constant_name); |
| 20069 | } else if (i.type === 'custom_obj') { |
| 20070 | return new torch.export.graph_signature.InputSpec( |
| 20071 | torch.export.graph_signature.InputKind.CUSTOM_OBJ, |
| 20072 | new torch.export.graph_signature.CustomObjArgument(i.custom_obj.arg.name, i.custom_obj.arg.class_fqn), |
| 20073 | i.custom_obj.custom_obj_name); |
| 20074 | } else if (i.type === 'token') { |
| 20075 | return new torch.export.graph_signature.InputSpec( |
| 20076 | torch.export.graph_signature.InputKind.TOKEN, |
| 20077 | new torch.export.graph_signature.TokenArgument(i.token.arg.name), |
| 20078 | null); |
| 20079 | } else if (i.type === 'constant_input') { |
| 20080 | return new torch.export.graph_signature.InputSpec( |
| 20081 | torch.export.graph_signature.InputKind.USER_INPUT, |
| 20082 | new torch.export.graph_signature.ConstantArgument(i.constant_input.name, this.deserialize_constant_input(i.constant_input.value)), |
| 20083 | null); |
| 20084 | } |
| 20085 | throw new python.Error(`Unknown input spec ${i}`); |
| 20086 | } |
| 20087 | deserialize_constant_input(inp) { |
| 20088 | if (inp.type === 'as_int') { |
| 20089 | return inp.as_int; |
no test coverage detected