Slice through an output tensor. This may copy unaligned slices, and schedule copying back on destruction.
| 753 | // Slice through an output tensor. This may copy unaligned slices, and |
| 754 | // schedule copying back on destruction. |
| 755 | Tensor OutputSlice(Tensor* t, int pos, const string& name) { |
| 756 | Tensor res = UnalignedSlice(*t, pos); |
| 757 | if (res.IsAligned()) { |
| 758 | return res; |
| 759 | } else { |
| 760 | Tensor aligned = AlignTensor(res, name); |
| 761 | copy_out_.emplace_back(res, aligned); |
| 762 | return aligned; |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | void FinishTimeStep() { |
| 767 | for (const auto& p : copy_out_) { |
no test coverage detected