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

Function TEST_F

tensorflow/core/kernels/data/shard_dataset_op_test.cc:317–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317TEST_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
353TEST_F(ShardDatasetOpTest, DatasetTypeString) {
354 int thread_num = 2, cpu_num = 2;

Callers

nothing calls this directly

Calls 15

TensorValueClass · 0.85
IteratorPrefixFunction · 0.85
ZeroNumShardsTestCaseFunction · 0.85
prefixMethod · 0.80
TestCase1Function · 0.70
OpNameFunction · 0.70
NegativeIndexTestCaseFunction · 0.70
TensorShapeClass · 0.50

Tested by

no test coverage detected