| 212 | } |
| 213 | |
| 214 | TEST_F(CacheDatasetOpTest, DatasetNodeName) { |
| 215 | int thread_num = 2, cpu_num = 2; |
| 216 | TestCase test_case = TestCase1(); |
| 217 | TF_ASSERT_OK(InitThreadPool(thread_num)); |
| 218 | TF_ASSERT_OK(InitFunctionLibraryRuntime({}, cpu_num)); |
| 219 | |
| 220 | std::unique_ptr<OpKernel> cache_dataset_kernel; |
| 221 | TF_ASSERT_OK(CreateCacheDatasetOpKernel(test_case.expected_output_dtypes, |
| 222 | test_case.expected_output_shapes, |
| 223 | &cache_dataset_kernel)); |
| 224 | Tensor tensor_slice_dataset_tensor(DT_VARIANT, TensorShape({})); |
| 225 | std::vector<Tensor> inputs_for_tensor_slice_dataset = test_case.input_tensors; |
| 226 | TF_ASSERT_OK(CreateTensorSliceDatasetTensor(&inputs_for_tensor_slice_dataset, |
| 227 | &tensor_slice_dataset_tensor)); |
| 228 | Tensor file_name = |
| 229 | CreateTensor<tstring>(TensorShape{}, {test_case.file_name}); |
| 230 | gtl::InlinedVector<TensorValue, 4> inputs( |
| 231 | {TensorValue(&tensor_slice_dataset_tensor), TensorValue(&file_name)}); |
| 232 | std::unique_ptr<OpKernelContext> cache_dataset_context; |
| 233 | TF_ASSERT_OK(CreateCacheDatasetContext(cache_dataset_kernel.get(), &inputs, |
| 234 | &cache_dataset_context)); |
| 235 | DatasetBase* cache_dataset; |
| 236 | TF_ASSERT_OK(CreateDataset(cache_dataset_kernel.get(), |
| 237 | cache_dataset_context.get(), &cache_dataset)); |
| 238 | core::ScopedUnref scoped_unref(cache_dataset); |
| 239 | |
| 240 | EXPECT_EQ(cache_dataset->node_name(), kNodeName); |
| 241 | } |
| 242 | |
| 243 | TEST_P(ParameterizedCacheDatasetOpTest, DatasetTypeString) { |
| 244 | int thread_num = 2, cpu_num = 2; |
nothing calls this directly
no test coverage detected