MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / PairwiseMatcherInto

Function PairwiseMatcherInto

python/mod_cvcuda/operators/OpPairwiseMatcher.cpp:34–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace {
33
34TupleTensor3 PairwiseMatcherInto(Tensor &matches, std::optional<Tensor> numMatches, std::optional<Tensor> distances,
35 Tensor &set1, Tensor &set2, std::optional<Tensor> numSet1,
36 std::optional<Tensor> numSet2, bool crossCheck, int matchesPerPoint,
37 std::optional<NVCVNormType> normType, NVCVPairwiseMatcherType algoChoice,
38 std::optional<Stream> pstream)
39{
40 if (!pstream)
41 {
42 pstream = Stream::Current();
43 }
44
45 if (!normType)
46 {
47 normType = NVCV_NORM_L2;
48 }
49
50 auto op = CreateOperator<cvcuda::PairwiseMatcher>(algoChoice);
51
52 ResourceGuard guard(*pstream);
53 guard.add(LockMode::LOCK_MODE_READ, {set1, set2});
54 guard.add(LockMode::LOCK_MODE_WRITE, {matches});
55 guard.add(LockMode::LOCK_MODE_NONE, {*op});
56
57 if (numSet1)
58 {
59 guard.add(LockMode::LOCK_MODE_READ, {*numSet1});
60 }
61 if (numSet2)
62 {
63 guard.add(LockMode::LOCK_MODE_READ, {*numSet2});
64 }
65 if (numMatches)
66 {
67 guard.add(LockMode::LOCK_MODE_WRITE, {*numMatches});
68 }
69 if (distances)
70 {
71 guard.add(LockMode::LOCK_MODE_WRITE, {*distances});
72 }
73
74 op->submit(pstream->cudaHandle(), set1, set2, (numSet1 ? *numSet1 : nvcv::Tensor{nullptr}),
75 (numSet2 ? *numSet2 : nvcv::Tensor{nullptr}), matches,
76 (numMatches ? *numMatches : nvcv::Tensor{nullptr}), (distances ? *distances : nvcv::Tensor{nullptr}),
77 crossCheck, matchesPerPoint, *normType);
78
79 return TupleTensor3(std::move(matches), numMatches, distances);
80}
81
82TupleTensor3 PairwiseMatcher(Tensor &set1, Tensor &set2, std::optional<Tensor> numSet1, std::optional<Tensor> numSet2,
83 std::optional<bool> numMatches, bool distances, bool crossCheck, int matchesPerPoint,

Callers 1

PairwiseMatcherFunction · 0.85

Calls 3

cudaHandleMethod · 0.80
addMethod · 0.45
submitMethod · 0.45

Tested by

no test coverage detected