| 30 | |
| 31 | namespace { |
| 32 | Tensor RandomResizedCropInto(Tensor &output, Tensor &input, double min_scale, double max_scale, double min_ratio, |
| 33 | double max_ratio, NVCVInterpolationType interp, uint32_t seed, |
| 34 | std::optional<Stream> pstream) |
| 35 | { |
| 36 | if (!pstream) |
| 37 | { |
| 38 | pstream = Stream::Current(); |
| 39 | } |
| 40 | |
| 41 | int32_t batchSize = static_cast<int32_t>(input.shape()[0]); |
| 42 | auto randomResizedCrop |
| 43 | = CreateOperator<cvcuda::RandomResizedCrop>(min_scale, max_scale, min_ratio, max_ratio, batchSize, seed); |
| 44 | |
| 45 | ResourceGuard guard(*pstream); |
| 46 | guard.add(LockMode::LOCK_MODE_READ, {input}); |
| 47 | guard.add(LockMode::LOCK_MODE_WRITE, {output}); |
| 48 | guard.add(LockMode::LOCK_MODE_READWRITE, {*randomResizedCrop}); |
| 49 | |
| 50 | randomResizedCrop->submit(pstream->cudaHandle(), input, output, interp); |
| 51 | |
| 52 | return std::move(output); |
| 53 | } |
| 54 | |
| 55 | Tensor RandomResizedCrop(Tensor &input, const Shape &out_shape, double min_scale, double max_scale, double min_ratio, |
| 56 | double max_ratio, NVCVInterpolationType interp, uint32_t seed, std::optional<Stream> pstream) |
no test coverage detected