* Get the feed mask for given key. * @param key The SymbolicTensor, or its name (as a string), of which the * value is sought. * @returns If `key` exists, the corresponding feed mask. * @throws ValueError: If `key` does not exist in this `FeedDict`.
(key: SymbolicTensor|string)
| 160 | * @throws ValueError: If `key` does not exist in this `FeedDict`. |
| 161 | */ |
| 162 | getMask(key: SymbolicTensor|string): Tensor { |
| 163 | if (key instanceof SymbolicTensor) { |
| 164 | if (this.id2Value[key.id] == null) { |
| 165 | throw new ValueError(`Nonexistent key: ${key.name}`); |
| 166 | } else { |
| 167 | return this.id2Mask[key.id]; |
| 168 | } |
| 169 | } else { |
| 170 | const id = this.name2Id[key]; |
| 171 | if (id == null) { |
| 172 | throw new ValueError(`Feed dict has no SymbolicTensor name: ${key}`); |
| 173 | } |
| 174 | return this.id2Mask[id]; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | /** Dispose all mask Tensors held by this object. */ |
| 179 | disposeMasks() { |