MCPcopy Create free account
hub / github.com/lutzroeder/netron / deserialize_output_spec

Method deserialize_output_spec

source/python.js:20101–20139  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

20099 throw new python.Error(`Unhandled constant argument ${inp} to deserialize.`);
20100 }
20101 deserialize_output_spec(o) {
20102 if (o.type === 'user_output') {
20103 return new torch.export.graph_signature.OutputSpec(
20104 torch.export.graph_signature.OutputKind.USER_OUTPUT,
20105 this.deserialize_argument_spec(o.user_output.arg),
20106 null);
20107 } else if (o.type === 'loss_output') {
20108 return new torch.export.graph_signature.OutputSpec(
20109 torch.export.graph_signature.OutputKind.LOSS_OUTPUT,
20110 new torch.export.graph_signature.TensorArgument(o.loss_output.arg.name),
20111 null);
20112 } else if (o.type === 'buffer_mutation') {
20113 return new torch.export.graph_signature.OutputSpec(
20114 torch.export.graph_signature.OutputKind.BUFFER_MUTATION,
20115 new torch.export.graph_signature.TensorArgument(o.buffer_mutation.arg.name),
20116 o.buffer_mutation.buffer_name);
20117 } else if (o.type === 'gradient_to_parameter') {
20118 return new torch.export.graph_signature.OutputSpec(
20119 torch.export.graph_signature.OutputKind.GRADIENT_TO_PARAMETER,
20120 new torch.export.graph_signature.TensorArgument(o.gradient_to_parameter.arg.name),
20121 o.gradient_to_parameter.parameter_name);
20122 } else if (o.type === 'gradient_to_user_input') {
20123 return new torch.export.graph_signature.OutputSpec(
20124 torch.export.graph_signature.OutputKind.GRADIENT_TO_USER_INPUT,
20125 new torch.export.graph_signature.TensorArgument(o.gradient_to_user_input.arg.name),
20126 o.gradient_to_user_input.user_input_name);
20127 } else if (o.type === 'user_input_mutation') {
20128 return new torch.export.graph_signature.OutputSpec(
20129 torch.export.graph_signature.OutputKind.USER_INPUT_MUTATION,
20130 new torch.export.graph_signature.TensorArgument(o.user_input_mutation.arg.name),
20131 o.user_input_mutation.user_input_name);
20132 } else if (o.type === 'token') {
20133 return new torch.export.graph_signature.OutputSpec(
20134 torch.export.graph_signature.OutputKind.TOKEN,
20135 new torch.export.graph_signature.TokenArgument(o.token.arg.name),
20136 null);
20137 }
20138 throw new python.Error(`Unknown output spec ${o}.`);
20139 }
20140 deserialize_signature(sig) {
20141 return new torch.export.graph_signature.ExportGraphSignature(
20142 sig.input_specs.map((i) => this.deserialize_input_spec(i)),

Callers 1

deserialize_signatureMethod · 0.80

Calls 1

Tested by

no test coverage detected