| 148 | |
| 149 | |
| 150 | void NumpyDecoder::RunImpl(Workspace &ws) { |
| 151 | const auto &input = ws.Input<CPUBackend>(0); |
| 152 | auto &output = ws.Output<CPUBackend>(0); |
| 153 | auto &tPool = ws.GetThreadPool(); |
| 154 | |
| 155 | for (int sampleIdx = 0; sampleIdx < input.num_samples(); ++sampleIdx) { |
| 156 | tPool.AddWork([&, sampleIdx](int) { |
| 157 | const numpy::HeaderData &header = headers_[sampleIdx]; |
| 158 | ConstSampleView<CPUBackend> inputView( |
| 159 | static_cast<const uint8_t *>(input.raw_tensor(sampleIdx)) + header.data_offset, |
| 160 | header.shape, header.type()); |
| 161 | RunDecoding(output[sampleIdx], std::move(inputView), header); |
| 162 | }); |
| 163 | } |
| 164 | tPool.RunAll(); |
| 165 | } |
| 166 | |
| 167 | DALI_REGISTER_OPERATOR(decoders__Numpy, NumpyDecoder, CPU); |
| 168 |
nothing calls this directly
no test coverage detected