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

Function TEST

tensorflow/core/framework/unique_tensor_references_test.cc:23–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21namespace tensorflow {
22
23TEST(UniquifyTensors, TestUniqueVector) {
24 UniqueTensorReferences refs;
25 Tensor a(DT_FLOAT, TensorShape({2, 2}));
26 Tensor b(DT_FLOAT, TensorShape({2, 2}));
27
28 EXPECT_FALSE(a.SharesBufferWith(b));
29
30 refs.Add(a);
31 refs.Add(b);
32 TensorReferenceVector tensors;
33 refs.FreezeAndReturnReferences(&tensors);
34 EXPECT_EQ(2, tensors.size());
35 if (tensors[0].SharesBufferWith(a)) {
36 EXPECT_TRUE(tensors[1].SharesBufferWith(b));
37 } else {
38 EXPECT_TRUE(tensors[1].SharesBufferWith(a));
39 EXPECT_TRUE(tensors[0].SharesBufferWith(b));
40 }
41 for (auto& t : tensors) {
42 t.Unref();
43 }
44}
45
46TEST(UniquifyTensors, TestNonUniqueVector) {
47 UniqueTensorReferences refs;

Callers

nothing calls this directly

Calls 6

TensorShapeClass · 0.70
SharesBufferWithMethod · 0.45
AddMethod · 0.45
sizeMethod · 0.45
UnrefMethod · 0.45

Tested by

no test coverage detected