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

Function TEST

tensorflow/compiler/jit/xla_compilation_cache_test.cc:23–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21namespace {
22
23TEST(XlaCompilationCacheTest, SignatureEquality) {
24 NameAttrList fn;
25 fn.set_name("afunction");
26 std::vector<XlaCompiler::Argument> args(1);
27 args[0].kind = XlaCompiler::Argument::kConstant;
28 args[0].type = DT_INT32;
29 args[0].shape = TensorShape({4, 0});
30 args[0].constant_value = Tensor(DT_INT32, {4, 0});
31 TF_ASSERT_OK_AND_ASSIGN(XlaCompilationCache::Signature s1,
32 XlaCompilationCache::BuildSignature(fn, args));
33
34 args[0].type = DT_FLOAT;
35 args[0].constant_value = Tensor(DT_FLOAT, {4, 0});
36 TF_ASSERT_OK_AND_ASSIGN(XlaCompilationCache::Signature s2,
37 XlaCompilationCache::BuildSignature(fn, args));
38
39 args[0].shape = TensorShape({0, 4});
40 args[0].constant_value = Tensor(DT_FLOAT, {0, 4});
41 TF_ASSERT_OK_AND_ASSIGN(XlaCompilationCache::Signature s3,
42 XlaCompilationCache::BuildSignature(fn, args));
43
44 std::vector<XlaCompilationCache::Signature> signatures = {s1, s2, s3};
45 for (int i = 0; i < signatures.size(); ++i) {
46 for (int j = 0; j < signatures.size(); ++j) {
47 EXPECT_EQ(i == j, signatures[i] == signatures[j])
48 << signatures[i].HumanString() << " " << signatures[j].HumanString();
49 }
50 }
51}
52
53} // namespace
54} // namespace tensorflow

Callers

nothing calls this directly

Calls 5

TensorShapeClass · 0.50
TensorClass · 0.50
set_nameMethod · 0.45
sizeMethod · 0.45
HumanStringMethod · 0.45

Tested by

no test coverage detected