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

Function CenterCropInto

python/mod_cvcuda/operators/OpCenterCrop.cpp:36–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35namespace {
36Tensor CenterCropInto(Tensor &output, Tensor &input, const std::tuple<int, int> &cropSize,
37 std::optional<Stream> pstream)
38{
39 if (!pstream)
40 {
41 pstream = Stream::Current();
42 }
43
44 auto center_crop = CreateOperator<cvcuda::CenterCrop>();
45
46 ResourceGuard guard(*pstream);
47 guard.add(LockMode::LOCK_MODE_READ, {input});
48 guard.add(LockMode::LOCK_MODE_WRITE, {output});
49 guard.add(LockMode::LOCK_MODE_NONE, {*center_crop});
50
51 nvcv::Size2D cropSizeArg{std::get<0>(cropSize), std::get<1>(cropSize)};
52
53 center_crop->submit(pstream->cudaHandle(), input, output, cropSizeArg);
54
55 return output;
56}
57
58Tensor CenterCrop(Tensor &input, const std::tuple<int, int> &cropSize, std::optional<Stream> pstream)
59{

Callers 1

CenterCropFunction · 0.85

Calls 3

cudaHandleMethod · 0.80
addMethod · 0.45
submitMethod · 0.45

Tested by

no test coverage detected