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

Function TEST_P

tensorflow/core/framework/bfloat16_test.cc:92–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 public ::testing::WithParamInterface<Bfloat16TestParam> {};
91
92TEST_P(Bfloat16Test, TruncateTest) {
93 bfloat16 truncated =
94 bfloat16(Eigen::bfloat16_impl::truncate_to_bfloat16((GetParam().input)));
95
96 if (std::isnan(GetParam().input)) {
97 EXPECT_TRUE(std::isnan(float(truncated)) || std::isinf(float(truncated)));
98 return;
99 }
100
101 EXPECT_EQ(GetParam().expected_truncation, float(truncated));
102
103 bfloat16 rounded = bfloat16(
104 Eigen::bfloat16_impl::float_to_bfloat16_rtne<false>((GetParam().input)));
105 if (std::isnan(GetParam().input)) {
106 EXPECT_TRUE(std::isnan(float(rounded)) || std::isinf(float(rounded)));
107 return;
108 }
109 EXPECT_EQ(GetParam().expected_rounding, float(rounded));
110}
111
112INSTANTIATE_TEST_SUITE_P(
113 Bfloat16Test_Instantiation, Bfloat16Test,

Callers

nothing calls this directly

Calls 3

GetParamFunction · 0.85
isnanClass · 0.85
isinfClass · 0.85

Tested by

no test coverage detected