| 137 | }; |
| 138 | |
| 139 | inline HQResizeTensorShapeI TensorShape(const nvcv::TensorLayout &layout, const nvcv::TensorShape &shape, |
| 140 | int resizeNDim) |
| 141 | { |
| 142 | assert(resizeNDim == 2 || resizeNDim == 3); |
| 143 | |
| 144 | char shapeArgLayout[4] = "DHW"; |
| 145 | HQResizeTensorShapeI tensorShape; |
| 146 | for (int d = 0; d < resizeNDim; d++) |
| 147 | { |
| 148 | int axis = layout.find(shapeArgLayout[d + 3 - resizeNDim]); |
| 149 | if (axis < 0) |
| 150 | { |
| 151 | throw std::runtime_error( |
| 152 | "The layout of an input tensor to the resize operator must contain HW extents in the layout (for " |
| 153 | "images) or DHW extents (for 3D resampling). Some extents are missing in the input tensor."); |
| 154 | } |
| 155 | tensorShape.extent[d] = shape[axis]; |
| 156 | } |
| 157 | int channelAxis = layout.find('C'); |
| 158 | tensorShape.numChannels = channelAxis < 0 ? 1 : shape[channelAxis]; |
| 159 | tensorShape.ndim = resizeNDim; |
| 160 | return tensorShape; |
| 161 | } |
| 162 | |
| 163 | class BatchShapesHelper |
| 164 | { |
no test coverage detected