| 27 | |
| 28 | namespace { |
| 29 | Tensor __OPNAME__Into(Tensor &output, Tensor &input, std::optional<Stream> pstream) |
| 30 | { |
| 31 | if (!pstream) |
| 32 | { |
| 33 | pstream = Stream::Current(); |
| 34 | } |
| 35 | |
| 36 | auto op = CreateOperator<cvcuda::__OPNAME__>(); |
| 37 | |
| 38 | ResourceGuard guard(*pstream); |
| 39 | guard.add(LockMode::LOCK_MODE_READ, {input}); |
| 40 | guard.add(LockMode::LOCK_MODE_WRITE, {output}); |
| 41 | // TODO if op kernel allocates resources that are accessed by the device change to READWRITE |
| 42 | // is set to none it is possible for the operator to be destroyed before the kernel is executed. |
| 43 | guard.add(LockMode::LOCK_MODE_NONE, {*op}); |
| 44 | |
| 45 | op->submit(pstream->cudaHandle(), input, output); |
| 46 | |
| 47 | return std::move(output); |
| 48 | } |
| 49 | |
| 50 | Tensor __OPNAME__(Tensor &input, nvcv::DataType dtype, std::optional<Stream> pstream) |
| 51 | { |
no test coverage detected