| 837 | } |
| 838 | |
| 839 | XlaOp XlaBuilder::SliceInDim(XlaOp operand, int64 start_index, |
| 840 | int64 limit_index, int64 stride, int64 dimno) { |
| 841 | return ReportErrorOrReturn([&]() -> StatusOr<XlaOp> { |
| 842 | TF_ASSIGN_OR_RETURN(const Shape* shape, GetShapePtr(operand)); |
| 843 | std::vector<int64> starts(shape->rank(), 0); |
| 844 | std::vector<int64> limits(shape->dimensions().begin(), |
| 845 | shape->dimensions().end()); |
| 846 | std::vector<int64> strides(shape->rank(), 1); |
| 847 | starts[dimno] = start_index; |
| 848 | limits[dimno] = limit_index; |
| 849 | strides[dimno] = stride; |
| 850 | return Slice(operand, starts, limits, strides); |
| 851 | }); |
| 852 | } |
| 853 | |
| 854 | XlaOp XlaBuilder::DynamicSlice(XlaOp operand, XlaOp start_indices, |
| 855 | absl::Span<const int64> slice_sizes) { |