29 #include "tests/datasets/ShapeDatasets.h"
32 #include "tests/validation/fixtures/DirectConvolutionLayerFixture.h"
52 { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f) });
63 const TensorShape src_shape_nhwc = TensorShape(8U, 27U, 13U);
64 const TensorShape wei_shape_nhwc = TensorShape(8U, 3U, 3U, 4U);
65 const TensorShape bia_shape = TensorShape(4U);
66 const TensorShape dst_shape_nhwc = TensorShape(4U, 25U, 11U);
70 auto src_nhwc = create_tensor<CLTensor>(src_shape_nhwc,
dt, 1, QuantizationInfo(),
data_layout);
71 auto wei_nhwc = create_tensor<CLTensor>(wei_shape_nhwc,
dt, 1, QuantizationInfo(),
data_layout);
72 auto dst_nhwc = create_tensor<CLTensor>(dst_shape_nhwc,
dt, 1, QuantizationInfo(),
data_layout);
74 TensorShape src_shape_nchw = src_shape_nhwc;
75 TensorShape wei_shape_nchw = wei_shape_nhwc;
76 TensorShape dst_shape_nchw = dst_shape_nhwc;
82 const PadStrideInfo
conv_info = PadStrideInfo(1, 1, 0, 0);
85 CLIndirectConvolutionLayer conv{};
86 conv.configure(&src_nhwc, &wei_nhwc,
nullptr, &dst_nhwc,
conv_info);
88 src_nhwc.allocator()->allocate();
89 wei_nhwc.allocator()->allocate();
90 dst_nhwc.allocator()->allocate();
92 library->fill_tensor_value(CLAccessor(src_nhwc), 1.f);
93 library->fill_tensor_value(CLAccessor(wei_nhwc), 1.f);
98 SimpleTensor<float> ref_src{ src_shape_nchw,
dt };
99 SimpleTensor<float> ref_wei{ wei_shape_nchw,
dt };
100 SimpleTensor<float> ref_bia{ bia_shape,
dt };
101 library->fill_tensor_value(ref_src, 1.f);
102 library->fill_tensor_value(ref_wei, 1.f);
104 library->fill_tensor_value(ref_bia, 0.f);
105 auto ref_dst = reference::convolution_layer<float>(ref_src, ref_wei, ref_bia, dst_shape_nchw,
conv_info);
107 validate(CLAccessor(dst_nhwc), ref_dst);
115 const TensorShape src_shape_nhwc = TensorShape(3U, 33U, 27U);
116 const TensorShape wei_shape_nhwc = TensorShape(3U, 5U, 7U, 4U);
117 const TensorShape bia_shape = TensorShape(4U);
118 const TensorShape dst_shape_nhwc = TensorShape(4U, 11U, 12U);
122 auto src_nhwc = create_tensor<CLTensor>(src_shape_nhwc,
dt, 1, QuantizationInfo(),
data_layout);
123 auto wei_nhwc = create_tensor<CLTensor>(wei_shape_nhwc,
dt, 1, QuantizationInfo(),
data_layout);
124 auto dst_nhwc = create_tensor<CLTensor>(dst_shape_nhwc,
dt, 1, QuantizationInfo(),
data_layout);
126 TensorShape src_shape_nchw = src_shape_nhwc;
127 TensorShape wei_shape_nchw = wei_shape_nhwc;
128 TensorShape dst_shape_nchw = dst_shape_nhwc;
137 CLIndirectConvolutionLayer conv{};
138 conv.configure(&src_nhwc, &wei_nhwc,
nullptr, &dst_nhwc,
conv_info);
140 src_nhwc.allocator()->allocate();
141 wei_nhwc.allocator()->allocate();
142 dst_nhwc.allocator()->allocate();
144 library->fill_tensor_value(CLAccessor(src_nhwc), 1.f);
145 library->fill_tensor_value(CLAccessor(wei_nhwc), 1.f);
150 SimpleTensor<float> ref_src{ src_shape_nchw,
dt };
151 SimpleTensor<float> ref_wei{ wei_shape_nchw,
dt };
152 SimpleTensor<float> ref_bia{ bia_shape,
dt };
153 library->fill_tensor_value(ref_src, 1.f);
154 library->fill_tensor_value(ref_wei, 1.f);
156 library->fill_tensor_value(ref_bia, 0.f);
157 auto ref_dst = reference::convolution_layer<float>(ref_src, ref_wei, ref_bia, dst_shape_nchw,
conv_info);
159 validate(CLAccessor(dst_nhwc), ref_dst);
165 template <
typename T>
167 template <
typename T>
201 framework::dataset::make(
"ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )),
256 framework::dataset::make(
"ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )),