Returns a handle to a given tensor and, optionally, remove it from the internal vector.
| 135 | // Returns a handle to a given tensor and, optionally, remove it from the |
| 136 | // internal vector. |
| 137 | tensorflow::TensorHandle* GetHandle(int i, bool remove) { |
| 138 | auto* handle = vector_[i]; |
| 139 | if (!remove) { |
| 140 | handle->Ref(); |
| 141 | } else { |
| 142 | // Don't increase the ref-count. Instead, simply take it out of the |
| 143 | // vector. |
| 144 | vector_[i] = nullptr; |
| 145 | } |
| 146 | return handle; |
| 147 | } |
| 148 | |
| 149 | int Size() const { return outputs_.size(); } |
| 150 |