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

Method VerifyCollocation

tensorflow/c/c_api_test.cc:1241–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1239 }
1240
1241 void VerifyCollocation(TF_Operation* op,
1242 const std::vector<string>& expected) {
1243 TF_AttrMetadata m =
1244 TF_OperationGetAttrMetadata(op, tensorflow::kColocationAttrName, s_);
1245 if (expected.empty()) {
1246 ASSERT_EQ(TF_INVALID_ARGUMENT, TF_GetCode(s_)) << TF_Message(s_);
1247 EXPECT_EQ("Operation 'add' has no attr named '_class'.",
1248 string(TF_Message(s_)));
1249 return;
1250 }
1251 EXPECT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_);
1252 EXPECT_EQ(1, m.is_list);
1253 EXPECT_EQ(expected.size(), m.list_size);
1254 EXPECT_EQ(TF_ATTR_STRING, m.type);
1255 std::vector<void*> values(expected.size());
1256 std::vector<size_t> lens(expected.size());
1257 std::unique_ptr<char[]> storage(new char[m.total_size]);
1258 TF_OperationGetAttrStringList(op, tensorflow::kColocationAttrName,
1259 values.data(), lens.data(), expected.size(),
1260 storage.get(), m.total_size, s_);
1261 EXPECT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_);
1262 for (int i = 0; i < expected.size(); ++i) {
1263 EXPECT_EQ(expected[i],
1264 string(static_cast<const char*>(values[i]), lens[i]));
1265 }
1266 }
1267
1268 void FinishAndVerify(TF_OperationDescription* desc,
1269 const std::vector<string>& expected) {

Callers

nothing calls this directly

Calls 8

TF_GetCodeFunction · 0.85
TF_MessageFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected