| 27 | |
| 28 | namespace { |
| 29 | Tensor ConvertToInto(Tensor &output, Tensor &input, float scale, float offset, std::optional<Stream> pstream) |
| 30 | { |
| 31 | if (!pstream) |
| 32 | { |
| 33 | pstream = Stream::Current(); |
| 34 | } |
| 35 | |
| 36 | auto cvt = CreateOperator<cvcuda::ConvertTo>(); |
| 37 | |
| 38 | ResourceGuard guard(*pstream); |
| 39 | guard.add(LockMode::LOCK_MODE_READ, {input}); |
| 40 | guard.add(LockMode::LOCK_MODE_WRITE, {output}); |
| 41 | guard.add(LockMode::LOCK_MODE_NONE, {*cvt}); |
| 42 | |
| 43 | cvt->submit(pstream->cudaHandle(), input, output, scale, offset); |
| 44 | |
| 45 | return std::move(output); |
| 46 | } |
| 47 | |
| 48 | Tensor ConvertTo(Tensor &input, nvcv::DataType dtype, float scale, float offset, std::optional<Stream> pstream) |
| 49 | { |
no test coverage detected