| 214 | protected: |
| 215 | template <typename NativeT> |
| 216 | void Run(const R1Spec& spec) { |
| 217 | // This can't be an std::vector, since you can't grab a Span of a |
| 218 | // vector<bool>. |
| 219 | absl::InlinedVector<NativeT, 1> input(spec.input_dim0); |
| 220 | std::iota(input.begin(), input.end(), NativeT()); |
| 221 | auto literal = LiteralUtil::CreateR1<NativeT>(input); |
| 222 | |
| 223 | XlaBuilder builder(TestName()); |
| 224 | auto original = Parameter(&builder, 0, literal.shape(), "p0"); |
| 225 | Slice(original, {spec.slice_start}, {spec.slice_limit}, |
| 226 | {spec.slice_stride}); |
| 227 | |
| 228 | // Ditto. |
| 229 | absl::InlinedVector<NativeT, 1> expected; |
| 230 | for (int i = spec.slice_start; i < spec.slice_limit; |
| 231 | i += spec.slice_stride) { |
| 232 | expected.push_back(i); |
| 233 | } |
| 234 | |
| 235 | TF_ASSERT_OK_AND_ASSIGN(std::unique_ptr<GlobalData> arg, |
| 236 | client_->TransferToServer(literal)); |
| 237 | ComputeAndCompareR1<NativeT>(&builder, expected, {arg.get()}); |
| 238 | } |
| 239 | }; |
| 240 | |
| 241 | // A version of SliceR1Test used to label and disable 'large' tests |
nothing calls this directly
no test coverage detected