| 71 | // terms of both shape, dtype, and value |
| 72 | template <typename T> |
| 73 | void Expect(BundleReader* reader, const string& key, |
| 74 | const Tensor& expected_val) { |
| 75 | // Tests for Contains(). |
| 76 | EXPECT_TRUE(reader->Contains(key)); |
| 77 | // Tests for LookupDtypeAndShape(). |
| 78 | DataType dtype; |
| 79 | TensorShape shape; |
| 80 | TF_ASSERT_OK(reader->LookupDtypeAndShape(key, &dtype, &shape)); |
| 81 | EXPECT_EQ(expected_val.dtype(), dtype); |
| 82 | EXPECT_EQ(expected_val.shape(), shape); |
| 83 | // Tests for Lookup(), checking tensor contents. |
| 84 | Tensor val(expected_val.dtype(), shape); |
| 85 | TF_ASSERT_OK(reader->Lookup(key, &val)); |
| 86 | test::ExpectTensorEqual<T>(val, expected_val); |
| 87 | } |
| 88 | |
| 89 | template <class T> |
| 90 | void ExpectVariant(BundleReader* reader, const string& key, |
nothing calls this directly
no test coverage detected