(def, self, schema, block)
| 16674 | return new torch.FunctionSchema(def.name, '', args, returns); |
| 16675 | } |
| 16676 | emitFormalArguments(def, self, schema, block) { |
| 16677 | const args = []; |
| 16678 | const params = def.args.args; |
| 16679 | const expected_annotation_size = self ? def.args.args.length - 1 : def.args.args.length; |
| 16680 | if (schema.arguments.length !== expected_annotation_size) { |
| 16681 | throw new python.Error('Invalid formal arguments.'); |
| 16682 | } |
| 16683 | let it = 0; |
| 16684 | if (self) { |
| 16685 | const param = params[it]; |
| 16686 | const name = param.arg; |
| 16687 | const new_input = block.addInput().setDebugName(name); |
| 16688 | this.environment_stack.setSugaredVar(param.range(), name, self.makeSugared(new_input), null); |
| 16689 | args.push(new torch.Argument(name, new_input.type())); |
| 16690 | it++; |
| 16691 | } |
| 16692 | const shouldDeriveType = this.shouldDeriveSetStateType(def, schema); |
| 16693 | let arg_annotation_idx = 0; |
| 16694 | for (; it < params.length; it++) { |
| 16695 | const param = params[it]; |
| 16696 | const name = param.arg; |
| 16697 | const new_input = block.addInput(); |
| 16698 | if (torch._C.meaningfulName(name)) { |
| 16699 | new_input.setDebugName(name); |
| 16700 | } |
| 16701 | let arg = schema.arguments[arg_annotation_idx++]; |
| 16702 | if (shouldDeriveType) { |
| 16703 | if (schema.arguments.length === 1) { |
| 16704 | throw new python.Error('Invalid schema.'); |
| 16705 | } |
| 16706 | const inferredStateType = this.getTypeForSetStateArg(def, self); |
| 16707 | arg = arg.cloneWithType(inferredStateType); |
| 16708 | } |
| 16709 | args.push(arg); |
| 16710 | new_input.setType(arg.type); |
| 16711 | this.environment_stack.setVar(param.range(), name, new_input); |
| 16712 | } |
| 16713 | return args; |
| 16714 | } |
| 16715 | emitOutput(range, schema, block) { |
| 16716 | const ret_type = this._def_stack[this._def_stack.length - 1]._merged_return_type; |
| 16717 | const placeholder_return = this.graph.insertNode(this.graph.createUninitialized(ret_type)).output(); |
no test coverage detected