(...args)
| 6834 | return anyMarked; |
| 6835 | } |
| 6836 | mark(...args) { |
| 6837 | if (args.length === 1 && args[0] instanceof torch.Block) { |
| 6838 | const [block] = args; |
| 6839 | let anyMarked = false; |
| 6840 | for (const node of block.nodes()) { |
| 6841 | if (this._sideEffectPolicy === 'DONT_DELETE_NODES_WITH_SIDE_EFFECTS' && this.hasSideEffects(node)) { |
| 6842 | const marked = this.mark(node); |
| 6843 | anyMarked = anyMarked || marked; |
| 6844 | } |
| 6845 | } |
| 6846 | const marked = this.markReturnNode(block.return_node()); |
| 6847 | anyMarked = anyMarked || marked; |
| 6848 | for (const node of block.nodes()) { |
| 6849 | if (node.kind() === 'prim::Loop') { |
| 6850 | const marked = this.markLoop(node); |
| 6851 | anyMarked = anyMarked || marked; |
| 6852 | } else { |
| 6853 | for (const subBlock of node.blocks()) { |
| 6854 | const marked = this.mark(subBlock); |
| 6855 | anyMarked = anyMarked || marked; |
| 6856 | } |
| 6857 | } |
| 6858 | const marked = this.markIfLive(node); |
| 6859 | anyMarked = anyMarked || marked; |
| 6860 | } |
| 6861 | return anyMarked; |
| 6862 | } |
| 6863 | if (args.length === 1 && args[0] instanceof torch.Node) { |
| 6864 | const [node] = args; |
| 6865 | if (this._marked.has(node)) { |
| 6866 | return false; |
| 6867 | } |
| 6868 | this._marked.add(node); |
| 6869 | let curNode = node; |
| 6870 | while (curNode && curNode.owningBlock()) { |
| 6871 | this.mark(curNode); |
| 6872 | curNode = curNode.owningBlock().owningNode(); |
| 6873 | } |
| 6874 | for (const input of node.inputs()) { |
| 6875 | if (!this._liveValues.has(input)) { |
| 6876 | this._liveValues.add(input); |
| 6877 | } |
| 6878 | } |
| 6879 | return true; |
| 6880 | } |
| 6881 | throw new python.Error('Not implemented.'); |
| 6882 | } |
| 6883 | markIfLive(node) { |
| 6884 | for (const output of node.outputs()) { |
| 6885 | if (this._liveValues.has(output)) { |
no test coverage detected