| 90 | |
| 91 | template<typename Backend, device_type_t execution_device = backend_to_device_type<Backend>::value> |
| 92 | std::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 | |
| 132 | std::unique_ptr<Pipeline> GetExternalSourcePipeline(bool no_copy, const std::string &device) { |
nothing calls this directly
no test coverage detected