(node)
| 18614 | return 'MIGHT'; |
| 18615 | } |
| 18616 | transformIf(node) { |
| 18617 | const [then_block, else_block] = node.blocks(); |
| 18618 | let then_pair = this.transformExits(then_block); |
| 18619 | let else_pair = this.transformExits(else_block); |
| 18620 | const then_status = this.getExitStatus(then_pair); |
| 18621 | const else_status = this.getExitStatus(else_pair); |
| 18622 | const if_status = this.calcIfExitStatus(then_status, else_status); |
| 18623 | if (if_status === 'THROWS') { |
| 18624 | return this.constructThrowsExitPair(); |
| 18625 | } |
| 18626 | if (if_status === 'WONT') { |
| 18627 | return this.constructWontExitPair(); |
| 18628 | } |
| 18629 | if (then_status === 'WONT' || then_status === 'THROWS') { |
| 18630 | const exit_vals = this.matchValuesWithUnitialized(else_pair.exitValues()); |
| 18631 | then_pair = new torch._C.ExitPair(then_pair.hasExited(), exit_vals); |
| 18632 | } else if (else_status === 'WONT' || else_status === 'THROWS') { |
| 18633 | const exit_vals = this.matchValuesWithUnitialized(then_pair.exitValues()); |
| 18634 | else_pair = new torch._C.ExitPair(else_pair.hasExited(), exit_vals); |
| 18635 | } |
| 18636 | let has_exited = null; |
| 18637 | if (if_status === 'WILL') { |
| 18638 | has_exited = this._true_val; |
| 18639 | } else { |
| 18640 | this.addIfOutputs(node, [then_pair.hasExited()], [else_pair.hasExited()]); |
| 18641 | has_exited = node.outputs().at(node.outputs().length - 1); |
| 18642 | } |
| 18643 | this.addIfOutputs(node, then_pair.exitValues(), else_pair.exitValues()); |
| 18644 | const num_exit_vals = then_pair.exitValues().size(); |
| 18645 | const exit_vals = node.outputs().slice(node.outputs().length - num_exit_vals); |
| 18646 | return new torch._C.ExitPair(has_exited, exit_vals); |
| 18647 | } |
| 18648 | transformExits(block) { |
| 18649 | const prev_target_block = this._target_block; |
| 18650 | this.updateTargetBlock(block); |
no test coverage detected