MCPcopy
hub / github.com/lutzroeder/netron / defaultSchemaFor

Method defaultSchemaFor

source/python.js:8167–8184  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

8165 return type.withContained(type.containedTypes((type) => this.unshapedType(type)));
8166 }
8167 defaultSchemaFor(fn) {
8168 const args = [];
8169 const returns = [];
8170 const g = fn.graph();
8171 const num_inputs = fn.num_inputs();
8172 for (let i = 0; i < num_inputs; i++) {
8173 const v = g.inputs()[i];
8174 const name = v.hasDebugName() ? v.debugNameBase() : `argument_${i}`;
8175 const argument = new torch.Argument(name, this.unshapedType(g.inputs()[i].type()));
8176 args.push(argument);
8177 }
8178 const num_outputs = g.outputs().length;
8179 for (let i = 0; i < num_outputs; i++) {
8180 const argument = new torch.Argument('', this.unshapedType(g.outputs()[i].type()));
8181 returns.push(argument);
8182 }
8183 return new torch.FunctionSchema(fn.name(), '', args, returns);
8184 }
8185 });
8186 this.registerType('torch.utils._contextlib._DecoratorContextManager', class {});
8187 this.registerType('torch.utils._contextlib._NoParamDecoratorContextManager', class extends torch.utils._contextlib._DecoratorContextManager {});

Callers 1

getSchemaMethod · 0.80

Calls 9

num_inputsMethod · 0.80
hasDebugNameMethod · 0.80
unshapedTypeMethod · 0.80
graphMethod · 0.45
inputsMethod · 0.45
typeMethod · 0.45
pushMethod · 0.45
outputsMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected