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

Function XLA_TEST_P

tensorflow/compiler/xla/tests/half_test.cc:50–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 public ::testing::WithParamInterface<UnaryOpTestParam> {};
49
50XLA_TEST_P(UnaryOpTest, Ops) {
51 std::vector<half> x({half(1.4), half(-2.3), half(3.2), half(-4.1), half(9.0),
52 half(42.0), half(-9.0), half(-100.0)});
53 XlaBuilder builder(TestName());
54 XlaOp x_opnd;
55 auto x_data = CreateR1Parameter<half>(x, /*parameter_number=*/0, "x",
56 &builder, &x_opnd);
57
58 std::function<half(half)> compute_func = GetParam().compute_func;
59 std::vector<half> expected;
60 for (int64 i = 0; i < x.size(); ++i) {
61 expected.push_back(compute_func(x[i]));
62 }
63
64 UnaryBuildFuncTy build_func = GetParam().build_func;
65 build_func(x_opnd);
66
67 ComputeAndCompareR1<half>(&builder, expected, {x_data.get()}, error_spec_);
68}
69
70half sign_imp(half value) {
71 const float x(std::move(value));

Callers

nothing calls this directly

Calls 6

TestNameFunction · 0.85
GetParamFunction · 0.85
halfClass · 0.50
sizeMethod · 0.45
push_backMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected