| 315 | } |
| 316 | |
| 317 | TEST_F(ShardDatasetOpTest, DatasetNodeName) { |
| 318 | int thread_num = 2, cpu_num = 2; |
| 319 | TestCase test_case = TestCase1(); |
| 320 | TF_ASSERT_OK(InitThreadPool(thread_num)); |
| 321 | TF_ASSERT_OK(InitFunctionLibraryRuntime({}, cpu_num)); |
| 322 | |
| 323 | std::unique_ptr<OpKernel> shard_dataset_kernel; |
| 324 | TF_ASSERT_OK(CreateShardDatasetOpKernel( |
| 325 | test_case.require_non_empty, test_case.expected_output_dtypes, |
| 326 | test_case.expected_output_shapes, &shard_dataset_kernel)); |
| 327 | |
| 328 | DatasetBase* range_dataset; |
| 329 | TF_ASSERT_OK(CreateRangeDataset<int64>( |
| 330 | test_case.range_dataset_param.start, test_case.range_dataset_param.end, |
| 331 | test_case.range_dataset_param.step, "range", &range_dataset)); |
| 332 | Tensor range_dataset_tensor(DT_VARIANT, TensorShape({})); |
| 333 | TF_ASSERT_OK( |
| 334 | StoreDatasetInVariantTensor(range_dataset, &range_dataset_tensor)); |
| 335 | |
| 336 | Tensor num_shards = test_case.num_shards; |
| 337 | Tensor index = test_case.index; |
| 338 | gtl::InlinedVector<TensorValue, 4> inputs({TensorValue(&range_dataset_tensor), |
| 339 | TensorValue(&num_shards), |
| 340 | TensorValue(&index)}); |
| 341 | std::unique_ptr<OpKernelContext> shard_dataset_context; |
| 342 | TF_ASSERT_OK(CreateShardDatasetContext(shard_dataset_kernel.get(), &inputs, |
| 343 | &shard_dataset_context)); |
| 344 | |
| 345 | DatasetBase* shard_dataset; |
| 346 | TF_ASSERT_OK(CreateDataset(shard_dataset_kernel.get(), |
| 347 | shard_dataset_context.get(), &shard_dataset)); |
| 348 | core::ScopedUnref scoped_unref_batch_dataset(shard_dataset); |
| 349 | |
| 350 | EXPECT_EQ(shard_dataset->node_name(), kNodeName); |
| 351 | } |
| 352 | |
| 353 | TEST_F(ShardDatasetOpTest, DatasetTypeString) { |
| 354 | int thread_num = 2, cpu_num = 2; |
nothing calls this directly
no test coverage detected