Slice through an input tensor. This may copy unaligned slices, but no copying back will be done at the end.
| 742 | // Slice through an input tensor. This may copy unaligned slices, but no |
| 743 | // copying back will be done at the end. |
| 744 | const Tensor InputSlice(const Tensor& t, int pos, const string& name) { |
| 745 | Tensor res = UnalignedSlice(t, pos); |
| 746 | if (res.IsAligned()) { |
| 747 | return res; |
| 748 | } else { |
| 749 | return AlignTensor(res, name); |
| 750 | } |
| 751 | } |
| 752 | |
| 753 | // Slice through an output tensor. This may copy unaligned slices, and |
| 754 | // schedule copying back on destruction. |