We don't swap the first tensor on the stack and any subsequent tensors that share the buffer with the first tensor.
| 80 | // We don't swap the first tensor on the stack and any subsequent tensors |
| 81 | // that share the buffer with the first tensor. |
| 82 | bool IsUsefulToSwap(const Tensor& tensor) const { |
| 83 | mutex_lock l(mu_); |
| 84 | if (stack_.empty()) { |
| 85 | return false; |
| 86 | } |
| 87 | const Tensor& first = stack_.front().tensor; |
| 88 | return !tensor.SharesBufferWith(first); |
| 89 | } |
| 90 | |
| 91 | void Close() { |
| 92 | mutex_lock l(mu_); |
no test coverage detected