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

Function TEST_F

tensorflow/core/kernels/data/cache_dataset_ops_test.cc:214–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214TEST_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
243TEST_P(ParameterizedCacheDatasetOpTest, DatasetTypeString) {
244 int thread_num = 2, cpu_num = 2;

Callers

nothing calls this directly

Calls 5

TensorValueClass · 0.85
TestCase1Function · 0.70
TensorShapeClass · 0.50
getMethod · 0.45
node_nameMethod · 0.45

Tested by

no test coverage detected