| 69 | } |
| 70 | |
| 71 | Tensor StackIntoInternal(Tensor &output, std::vector<Tensor> &tensorList, std::optional<Stream> pstream, |
| 72 | int32_t numberOfTensors) |
| 73 | { |
| 74 | if (!pstream) |
| 75 | { |
| 76 | pstream = Stream::Current(); |
| 77 | } |
| 78 | |
| 79 | nvcvpy::TensorBatch inTensorBatch = nvcvpy::TensorBatch::Create(numberOfTensors); |
| 80 | |
| 81 | for (auto &tensor : tensorList) |
| 82 | { |
| 83 | inTensorBatch.pushBack(tensor); |
| 84 | } |
| 85 | |
| 86 | auto op = CreateOperator<cvcuda::Stack>(); |
| 87 | |
| 88 | ResourceGuard guard(*pstream); |
| 89 | guard.add(LockMode::LOCK_MODE_READ, {inTensorBatch}); |
| 90 | guard.add(LockMode::LOCK_MODE_WRITE, {output}); |
| 91 | guard.add(LockMode::LOCK_MODE_NONE, {*op}); |
| 92 | op->submit(pstream->cudaHandle(), inTensorBatch, output); |
| 93 | return std::move(output); |
| 94 | } |
| 95 | |
| 96 | Tensor StackInto(Tensor &output, std::vector<Tensor> &tensorList, std::optional<Stream> pstream) |
| 97 | { |