(tree, magicMethod, opSymbol)
| 17192 | return out; |
| 17193 | } |
| 17194 | emitUnaryOp(tree, magicMethod, opSymbol) { |
| 17195 | const inputs = [tree.operand]; |
| 17196 | const named_values = this.getNamedValues(inputs, /*maybe_unpack=*/false); |
| 17197 | const val = torch._C.asSimple(torch._C.makeMagic(magicMethod, new torch._C.BuiltinFunction(opSymbol, null)).call(tree.range(), this.method, named_values, [], 0)); |
| 17198 | if (val.node().kind() !== opSymbol) { |
| 17199 | return val; |
| 17200 | } |
| 17201 | const maybe_out_stack = torch._C.runNodeIfInputsAreConstant(val.node()); |
| 17202 | if (!maybe_out_stack) { |
| 17203 | return val; |
| 17204 | } |
| 17205 | torch._C.TORCH_INTERNAL_ASSERT(maybe_out_stack.length === 1); |
| 17206 | return this.graph.insertConstant(maybe_out_stack[0], tree); |
| 17207 | } |
| 17208 | emitAssignment(stmt) { |
| 17209 | if (stmt instanceof ast.AnnAssign) { |
| 17210 | return this.emitSingleAssignment(stmt); |
no test coverage detected