| 274 | |
| 275 | TEST_SUITE(SpecialCases) |
| 276 | TEST_CASE(PaddedChannelNHWC, framework::DatasetMode::PRECOMMIT) |
| 277 | { |
| 278 | // Const data |
| 279 | const TensorShape src_shape = TensorShape(7U, 27U, 13U); |
| 280 | const DataType data_type = DataType::F32; |
| 281 | const DataLayout data_layout = DataLayout::NHWC; |
| 282 | const bool has_bias = false; |
| 283 | const unsigned int num_groups = 1; |
| 284 | const Size2D spatial_kernel(3, 3); |
| 285 | const QuantizationInfo qinfo{}; |
| 286 | const PadStrideInfo conv_info(1U, 1U, 0U, 0U); |
| 287 | |
| 288 | // Calculate destination shape |
| 289 | TensorInfo src_info(src_shape, 1, data_type); |
| 290 | src_info.set_data_layout(data_layout); |
| 291 | const TensorShape dst_shape = |
| 292 | compute_im2col_conv_shape(&src_info, spatial_kernel, conv_info, has_bias, Size2D(1U, 1U), false, num_groups); |
| 293 | |
| 294 | // Compute target |
| 295 | Tensor src_target = create_tensor<Tensor>(src_shape, data_type, 1, qinfo, data_layout); |
| 296 | Tensor dst_target = create_tensor<Tensor>(dst_shape, data_type, 1, qinfo); |
| 297 | |
| 298 | // Configure target function |
| 299 | CpuIm2Col im2col_func; |
| 300 | im2col_func.configure(src_target.info(), dst_target.info(), spatial_kernel, conv_info, has_bias); |
| 301 | |
| 302 | // Extend padding |
| 303 | src_target.info()->extend_padding(PaddingSize(3, 5, 9, 1)); |
| 304 | dst_target.info()->extend_padding(PaddingSize(8, 1, 1, 3)); |
| 305 | |
| 306 | // Validate and allocate tensors |
| 307 | ARM_COMPUTE_EXPECT(src_target.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 308 | ARM_COMPUTE_EXPECT(dst_target.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 309 | |
| 310 | src_target.allocator()->allocate(); |
| 311 | dst_target.allocator()->allocate(); |
| 312 | |
| 313 | ARM_COMPUTE_EXPECT(!src_target.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 314 | ARM_COMPUTE_EXPECT(!dst_target.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 315 | |
| 316 | // Fill target source |
| 317 | library->fill_tensor_uniform(Accessor(src_target), 0); |
| 318 | |
| 319 | ITensorPack pack = {{TensorType::ACL_SRC, &src_target}, {TensorType::ACL_DST, &dst_target}}; |
| 320 | // Run target function |
| 321 | im2col_func.run(pack); |
| 322 | |
| 323 | // Calculate Reference |
| 324 | SimpleTensor<float> src_ref{src_shape, data_type, 1, qinfo, data_layout}; |
| 325 | SimpleTensor<float> dst_ref{dst_shape, data_type, 1, qinfo, DataLayout::NCHW}; |
| 326 | |
| 327 | // Fill reference source |
| 328 | library->fill_tensor_uniform(src_ref, 0); |
| 329 | |
| 330 | #ifndef DOXYGEN_SKIP_THIS |
| 331 | // Run reference function |
| 332 | reference::im2col(src_ref, dst_ref, spatial_kernel, conv_info, has_bias, num_groups, 0); |
| 333 | #endif // DOXYGEN_SKIP_THIS |
nothing calls this directly
no test coverage detected