(loc, f, args, kwargs /*, n_binders */)
| 15787 | this._method_names = method_names; |
| 15788 | } |
| 15789 | call(loc, f, args, kwargs /*, n_binders */) { |
| 15790 | const argsWithSelf = [new torch._C.NamedValue(this._self), ...args]; |
| 15791 | const schemas = []; |
| 15792 | for (const method_name of this._method_names) { |
| 15793 | const type = this._self.type(); |
| 15794 | if (type instanceof torch.ClassType) { |
| 15795 | const class_type = type; |
| 15796 | const method = class_type.getMethod(method_name); |
| 15797 | method.ensure_defined(); |
| 15798 | schemas.push(method.getSchema()); |
| 15799 | } else if (type instanceof torch.InterfaceType) { |
| 15800 | const interface_type = type; |
| 15801 | schemas.push(interface_type.getMethod(method_name)); |
| 15802 | } else { |
| 15803 | throw new python.Error('Method constructed that is not a class or interface.'); |
| 15804 | } |
| 15805 | } |
| 15806 | const match = torch._C.matchSchemas(schemas, loc, f.graph(), argsWithSelf, kwargs); |
| 15807 | const output = f.graph().insertMethodCall(this._method_names[match[0]], match[1]); |
| 15808 | output.node().setSourceRange(loc); |
| 15809 | return new torch._C.SimpleValue(output); |
| 15810 | } |
| 15811 | }); |
| 15812 | this.registerType('torch._C.ClassValue', class extends torch._C.SugaredValue { |
| 15813 | constructor(type) { |
nothing calls this directly
no test coverage detected