| 61 | * bias leads to a successful run. |
| 62 | */ |
| 63 | TEST_CASE(NoBias, framework::DatasetMode::PRECOMMIT) |
| 64 | { |
| 65 | const TensorShape src_shape_nhwc = TensorShape(8U, 27U, 13U); |
| 66 | const TensorShape wei_shape_nhwc = TensorShape(8U, 3U, 3U, 4U); |
| 67 | const TensorShape bia_shape = TensorShape(4U); |
| 68 | const TensorShape dst_shape_nhwc = TensorShape(4U, 25U, 11U); |
| 69 | constexpr DataType dt = DataType::F32; |
| 70 | constexpr DataLayout data_layout = DataLayout::NHWC; |
| 71 | |
| 72 | auto src_nhwc = create_tensor<CLTensor>(src_shape_nhwc, dt, 1, QuantizationInfo(), data_layout); |
| 73 | auto wei_nhwc = create_tensor<CLTensor>(wei_shape_nhwc, dt, 1, QuantizationInfo(), data_layout); |
| 74 | auto dst_nhwc = create_tensor<CLTensor>(dst_shape_nhwc, dt, 1, QuantizationInfo(), data_layout); |
| 75 | |
| 76 | TensorShape src_shape_nchw = src_shape_nhwc; |
| 77 | TensorShape wei_shape_nchw = wei_shape_nhwc; |
| 78 | TensorShape dst_shape_nchw = dst_shape_nhwc; |
| 79 | |
| 80 | permute(src_shape_nchw, PermutationVector(1U, 2U, 0U)); |
| 81 | permute(wei_shape_nchw, PermutationVector(1U, 2U, 0U, 3U)); |
| 82 | permute(dst_shape_nchw, PermutationVector(1U, 2U, 0U)); |
| 83 | |
| 84 | const PadStrideInfo conv_info = PadStrideInfo(1, 1, 0, 0); |
| 85 | |
| 86 | // Create indirect Convolution function |
| 87 | CLIndirectConvolutionLayer conv{}; |
| 88 | conv.configure(&src_nhwc, &wei_nhwc, nullptr, &dst_nhwc, conv_info); |
| 89 | |
| 90 | src_nhwc.allocator()->allocate(); |
| 91 | wei_nhwc.allocator()->allocate(); |
| 92 | dst_nhwc.allocator()->allocate(); |
| 93 | |
| 94 | library->fill_tensor_value(CLAccessor(src_nhwc), 1.f); |
| 95 | library->fill_tensor_value(CLAccessor(wei_nhwc), 1.f); |
| 96 | |
| 97 | conv.run(); |
| 98 | |
| 99 | // Compute reference to compare |
| 100 | SimpleTensor<float> ref_src{src_shape_nchw, dt}; |
| 101 | SimpleTensor<float> ref_wei{wei_shape_nchw, dt}; |
| 102 | SimpleTensor<float> ref_bia{bia_shape, dt}; |
| 103 | library->fill_tensor_value(ref_src, 1.f); |
| 104 | library->fill_tensor_value(ref_wei, 1.f); |
| 105 | // No bias |
| 106 | library->fill_tensor_value(ref_bia, 0.f); |
| 107 | auto ref_dst = reference::convolution_layer<float>(ref_src, ref_wei, ref_bia, dst_shape_nchw, conv_info); |
| 108 | |
| 109 | validate(CLAccessor(dst_nhwc), ref_dst); |
| 110 | } |
| 111 | |
| 112 | /** Check whether the case of rectangle kernels i.e. when width and height of the weight_shape are not equal |
| 113 | * would lead to successful run |
nothing calls this directly
no test coverage detected