| 78 | } |
| 79 | |
| 80 | ImageBatchVarShape MorphologyVarShapeInto(ImageBatchVarShape &output, ImageBatchVarShape &input, |
| 81 | NVCVMorphologyType morph_type, Tensor &masks, Tensor &anchors, |
| 82 | std::optional<ImageBatchVarShape> workspace, const int32_t iteration, |
| 83 | const NVCVBorderType borderMode, std::optional<Stream> pstream) |
| 84 | { |
| 85 | if (!pstream) |
| 86 | { |
| 87 | pstream = Stream::Current(); |
| 88 | } |
| 89 | |
| 90 | auto morphology = CreateOperator<cvcuda::Morphology>(); |
| 91 | |
| 92 | ResourceGuard guard(*pstream); |
| 93 | guard.add(LockMode::LOCK_MODE_READ, {input}); |
| 94 | guard.add(LockMode::LOCK_MODE_READWRITE, {output, masks, anchors}); |
| 95 | guard.add(LockMode::LOCK_MODE_READWRITE, {*morphology}); |
| 96 | |
| 97 | if (workspace) |
| 98 | { |
| 99 | guard.add(LockMode::LOCK_MODE_READ, {*workspace}); |
| 100 | morphology->submit(pstream->cudaHandle(), input, output, *workspace, morph_type, masks, anchors, iteration, |
| 101 | borderMode); |
| 102 | } |
| 103 | else |
| 104 | { |
| 105 | morphology->submit(pstream->cudaHandle(), input, output, nvcv::NullOpt, morph_type, masks, anchors, iteration, |
| 106 | borderMode); |
| 107 | } |
| 108 | |
| 109 | return output; |
| 110 | } |
| 111 | |
| 112 | ImageBatchVarShape MorphologyVarShape(ImageBatchVarShape &input, NVCVMorphologyType morph_type, Tensor &masks, |
| 113 | Tensor &anchors, std::optional<ImageBatchVarShape> workspace, |
no test coverage detected