* Dispose the tensors and idTensor and mark the TensoryArray as closed.
(keepIds?: Set<number>)
| 53 | * Dispose the tensors and idTensor and mark the TensoryArray as closed. |
| 54 | */ |
| 55 | clearAndClose(keepIds?: Set<number>) { |
| 56 | this.tensors.forEach(tensor => { |
| 57 | if (keepIds == null || !keepIds.has(tensor.tensor.id)) { |
| 58 | tensor.tensor.dispose(); |
| 59 | } |
| 60 | }); |
| 61 | this.tensors = []; |
| 62 | this.closed_ = true; |
| 63 | this.idTensor.dispose(); |
| 64 | } |
| 65 | |
| 66 | size(): number { |
| 67 | return this.tensors.length; |