| 34 | |
| 35 | namespace { |
| 36 | Tensor CenterCropInto(Tensor &output, Tensor &input, const std::tuple<int, int> &cropSize, |
| 37 | std::optional<Stream> pstream) |
| 38 | { |
| 39 | if (!pstream) |
| 40 | { |
| 41 | pstream = Stream::Current(); |
| 42 | } |
| 43 | |
| 44 | auto center_crop = CreateOperator<cvcuda::CenterCrop>(); |
| 45 | |
| 46 | ResourceGuard guard(*pstream); |
| 47 | guard.add(LockMode::LOCK_MODE_READ, {input}); |
| 48 | guard.add(LockMode::LOCK_MODE_WRITE, {output}); |
| 49 | guard.add(LockMode::LOCK_MODE_NONE, {*center_crop}); |
| 50 | |
| 51 | nvcv::Size2D cropSizeArg{std::get<0>(cropSize), std::get<1>(cropSize)}; |
| 52 | |
| 53 | center_crop->submit(pstream->cudaHandle(), input, output, cropSizeArg); |
| 54 | |
| 55 | return output; |
| 56 | } |
| 57 | |
| 58 | Tensor CenterCrop(Tensor &input, const std::tuple<int, int> &cropSize, std::optional<Stream> pstream) |
| 59 | { |
no test coverage detected