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

Function TEST_F

tensorflow/core/grappler/utils/functions_test.cc:37–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35class FunctionsTest : public ::testing::Test {};
36
37TEST_F(FunctionsTest, IsParametrized) {
38 // Function is defined for multiple input types.
39 FunctionDef parametrized_func = FunctionDefHelper::Create(
40 "MyMul", {"x:T", "y:T"}, {"z:T"}, {"T: {float, double}"},
41 {{{"output"}, "Mul", {"x", "y"}, {{"T", "$T"}}}},
42 /* Mapping between function returns and function node outputs. */
43 {{"z", "output:z:0"}});
44
45 // Function is defined just for float inputs.
46 FunctionDef non_parametrized_func = FunctionDefHelper::Create(
47 "MyMul", {"x:float", "y:float"}, {"z:float"}, {},
48 {{{"output"}, "Mul", {"x", "y"}, {{"T", DT_FLOAT}}}},
49 /* Mapping between function returns and function node outputs. */
50 {{"z", "output:z:0"}});
51
52 EXPECT_TRUE(HasParametrizedType(parametrized_func));
53 EXPECT_TRUE(HasParametrizedBody(parametrized_func));
54 EXPECT_TRUE(IsParametrized(parametrized_func));
55
56 EXPECT_FALSE(HasParametrizedType(non_parametrized_func));
57 EXPECT_FALSE(HasParametrizedBody(non_parametrized_func));
58 EXPECT_FALSE(IsParametrized(non_parametrized_func));
59}
60
61TEST_F(FunctionsTest, InstantiationParameters) {
62 // Function definition is invalid, only type/body parameters are important.

Callers

nothing calls this directly

Calls 15

HasParametrizedTypeFunction · 0.85
HasParametrizedBodyFunction · 0.85
IsParametrizedFunction · 0.85
AttrSliceClass · 0.85
MakeGrapplerFunctionItemFunction · 0.85
MakeFunctionDefFunction · 0.85
ReplaceInputWithConstFunction · 0.85
GDefFunction · 0.85
NDefFunction · 0.85
FunctionDefsEqualFunction · 0.85

Tested by

no test coverage detected