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

Function PillowResizeInto

python/mod_cvcuda/operators/OpPillowResize.cpp:178–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176};
177
178Tensor PillowResizeInto(Tensor &output, Tensor &input, nvcv::ImageFormat format, NVCVInterpolationType interp,
179 std::optional<Stream> pstream)
180{
181 if (!pstream)
182 {
183 pstream = Stream::Current();
184 }
185 auto in_access = nvcv::TensorDataAccessStridedImagePlanar::Create(input.exportData());
186 auto out_access = nvcv::TensorDataAccessStridedImagePlanar::Create(output.exportData());
187 if (!in_access || !out_access)
188 {
189 throw std::runtime_error("Incompatible input/output tensor layout");
190 }
191
192 // Use CreateOperatorEx to use the extended create operator function passing the specialized PyOperator above
193 // as template type, instead of the regular cvcuda::OP class used in the CreateOperator function.
194 auto pillowResize = CreateOperatorEx<PyOpPillowResize>();
195
196 ResourceGuard guard(*pstream);
197 guard.add(LockMode::LOCK_MODE_READ, {input});
198 guard.add(LockMode::LOCK_MODE_WRITE, {output});
199 guard.add(LockMode::LOCK_MODE_READWRITE, {*pillowResize});
200
201 pillowResize->submit(pstream->cudaHandle(), input, output, format, interp);
202
203 return output;
204}
205
206Tensor PillowResize(Tensor &input, const Shape &out_shape, nvcv::ImageFormat format, NVCVInterpolationType interp,
207 std::optional<Stream> pstream)

Callers 1

PillowResizeFunction · 0.85

Calls 4

cudaHandleMethod · 0.80
exportDataMethod · 0.45
addMethod · 0.45
submitMethod · 0.45

Tested by

no test coverage detected