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

Function TEST

tensorflow/core/framework/attr_value_util_test.cc:62–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62TEST(AttrValueUtil, HasType) {
63 // OK
64 EXPECT_TRUE(AttrValueHasType(V(123), "int").ok());
65 EXPECT_TRUE(AttrValueHasType(V(1.2), "float").ok());
66 EXPECT_TRUE(AttrValueHasType(V(DT_FLOAT), "type").ok());
67 EXPECT_TRUE(AttrValueHasType(F("f", {}), "func").ok());
68 EXPECT_TRUE(AttrValueHasType(Fs({{"f", {}}, {"g", {}}}), "list(func)").ok());
69
70 // not OK.
71 EXPECT_FALSE(AttrValueHasType(V(123), "func").ok());
72 EXPECT_FALSE(AttrValueHasType(V(1.2), "int").ok());
73 EXPECT_FALSE(AttrValueHasType(V(DT_FLOAT), "shape").ok());
74 EXPECT_FALSE(AttrValueHasType(F("f", {}), "string").ok());
75 EXPECT_FALSE(AttrValueHasType(P("T"), "float").ok());
76 EXPECT_FALSE(AttrValueHasType(V(static_cast<DataType>(1000)), "type").ok());
77 std::vector<DataType> list_type({static_cast<DataType>(1000)});
78 EXPECT_FALSE(AttrValueHasType(V(list_type), "list(type)").ok());
79}
80
81SubstituteFunc ReplaceTWith(const AttrValue& val) {
82 return [val](const string& placeholder, AttrValue* target) {

Callers

nothing calls this directly

Calls 15

AttrValueHasTypeFunction · 0.85
PFunction · 0.85
HasPlaceHolderFunction · 0.85
SummarizeAttrValueFunction · 0.85
SubstitutePlaceholdersFunction · 0.85
ReplaceTWithFunction · 0.85
PartialTensorShapeClass · 0.85
AreAttrValuesEqualFunction · 0.85
AttrValueHashFunction · 0.85
VFunction · 0.70
FFunction · 0.70
TensorShapeClass · 0.70

Tested by

no test coverage detected