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

Function TEST

tensorflow/core/common_runtime/eager/attr_builder_test.cc:37–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35namespace {
36
37TEST(AttrTypeMap, Lookup) {
38 const AttrTypeMap* m = nullptr;
39 // Unknown ops are assumed to be functions.
40 // Their maps are filled with default attributes.
41 bool is_function = false;
42 Status s = AttrTypeMapForOp("SomeFunctionName", &m, &is_function);
43 EXPECT_TRUE(s.ok());
44 EXPECT_TRUE(is_function);
45 ASSERT_NE(m->end(), m->find("executor_type"));
46 EXPECT_EQ(TF_ATTR_STRING, m->find("executor_type")->second);
47 ASSERT_NE(m->end(), m->find("config_proto"));
48 EXPECT_EQ(TF_ATTR_STRING, m->find("config_proto")->second);
49
50 is_function = true;
51 s = AttrTypeMapForOp("MatMul", &m, &is_function);
52 EXPECT_FALSE(is_function);
53 ASSERT_TRUE(s.ok()) << s;
54
55 TF_AttrType t;
56 unsigned char is_list = 1;
57 s = AttrTypeByName(*m, "ThisAttribyteCannotPossiblyExist", &t, &is_list);
58 EXPECT_FALSE(s.ok());
59 EXPECT_NE(is_list, 0);
60 s = AttrTypeByName(*m, "transpose_a", &t, &is_list);
61 ASSERT_TRUE(s.ok()) << s;
62 EXPECT_EQ(TF_ATTR_BOOL, t);
63 EXPECT_EQ(is_list, 0);
64
65 s = AttrTypeMapForOp("Squeeze", &m, &is_function);
66 ASSERT_TRUE(s.ok()) << s;
67 s = AttrTypeByName(*m, "squeeze_dims", &t, &is_list);
68 ASSERT_TRUE(s.ok()) << s;
69 EXPECT_EQ(TF_ATTR_INT, t);
70 EXPECT_NE(is_list, 0);
71}
72
73TEST(AttrTypeMap, CacheKey) {
74 AttrBuilder a("op_name");

Callers

nothing calls this directly

Calls 8

AttrTypeMapForOpFunction · 0.85
AttrTypeByNameFunction · 0.85
CacheKeyMethod · 0.80
okMethod · 0.45
endMethod · 0.45
findMethod · 0.45
NumInputsMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected