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

Function GetTensorLayoutFor

src/nvcv/src/priv/TensorData.cpp:30–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace nvcv::priv {
29
30NVCVTensorLayout GetTensorLayoutFor(ImageFormat fmt, int nbatches)
31{
32 (void)nbatches;
33
34 int nplanes = fmt.numPlanes();
35
36 if (nplanes == 1)
37 {
38 return NVCV_TENSOR_NHWC;
39 }
40 else if (nplanes == fmt.numChannels())
41 {
42 return NVCV_TENSOR_NCHW;
43 }
44 else
45 {
46 throw Exception(NVCV_ERROR_INVALID_ARGUMENT) << "Image format cannot be semi-planar, but it is: " << fmt;
47 }
48}
49
50void FillTensorData(IImage &img, NVCVTensorData &tensorData)
51{

Callers 1

CalcRequirementsMethod · 0.85

Calls 3

ExceptionClass · 0.85
numPlanesMethod · 0.45
numChannelsMethod · 0.45

Tested by

no test coverage detected