MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Run

Method Run

tensorflow/compiler/xla/tests/slice_test.cc:216–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

TestNameFunction · 0.85
ParameterFunction · 0.50
SliceFunction · 0.50
TF_ASSERT_OK_AND_ASSIGNFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
shapeMethod · 0.45
push_backMethod · 0.45
TransferToServerMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected