MCPcopy Create free account
hub / github.com/NVIDIA/DALI / GetTestPipeline

Function GetTestPipeline

dali/c_api/c_api_test.cc:92–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91template<typename Backend, device_type_t execution_device = backend_to_device_type<Backend>::value>
92std::unique_ptr<Pipeline> GetTestPipeline(bool is_file_reader, const std::string &output_device) {
93 int dev = output_device == "cpu" ? CPU_ONLY_DEVICE_ID : device_id;
94 auto pipe_ptr = std::make_unique<Pipeline>(batch_size, num_thread, dev, seed, pipelined,
95 prefetch_queue_depth, async);
96 auto &pipe = *pipe_ptr;
97 std::string exec_device = GetDeviceStr(execution_device);
98 if (is_file_reader) {
99 std::string file_root = testing::dali_extra_path() + "/db/single/jpeg/";
100 std::string file_list = file_root + "image_list.txt";
101 pipe.AddOperator(OpSpec("FileReader")
102 .AddArg("device", "cpu")
103 .AddArg("file_root", file_root)
104 .AddArg("file_list", file_list)
105 .AddOutput("compressed_images", StorageDevice::CPU)
106 .AddOutput("labels", StorageDevice::CPU));
107
108 pipe.AddOperator(OpSpec("ImageDecoder")
109 .AddArg("device", "cpu")
110 .AddArg("output_type", DALI_RGB)
111 .AddInput("compressed_images", StorageDevice::CPU)
112 .AddOutput(input_name, StorageDevice::CPU));
113 } else {
114 pipe.AddExternalInput(input_name);
115 }
116 // Some Op
117 pipe.AddOperator(OpSpec("Resize")
118 .AddArg("device", exec_device)
119 .AddArg("image_type", DALI_RGB)
120 .AddArg("resize_x", output_size)
121 .AddArg("resize_y", output_size)
122 .AddInput(input_name, ParseStorageDevice(exec_device))
123 .AddOutput(output_name, ParseStorageDevice(exec_device)));
124
125 std::vector<std::pair<std::string, std::string>> outputs = {{output_name, output_device}};
126
127 pipe.SetOutputDescs(outputs);
128 return pipe_ptr;
129}
130
131
132std::unique_ptr<Pipeline> GetExternalSourcePipeline(bool no_copy, const std::string &device) {

Callers

nothing calls this directly

Calls 7

GetDeviceStrFunction · 0.85
ParseStorageDeviceFunction · 0.85
AddOutputMethod · 0.80
AddExternalInputMethod · 0.80
SetOutputDescsMethod · 0.80
OpSpecClass · 0.50
AddOperatorMethod · 0.45

Tested by

no test coverage detected