24 #ifndef ARM_COMPUTE_GC 25 #error "This example needs to be built with -DARM_COMPUTE_GC" 30 #include "half/half.hpp" 34 using namespace utils;
36 class GCDCExample :
public Example 39 bool do_setup(
int argc,
char **argv)
override 48 const unsigned int kernel_size = 3;
49 const int stride_x = 1;
50 const int stride_y = 1;
53 const unsigned int num_kernels = 256;
57 const TensorShape weights_shape(kernel_size, kernel_size, src_shape.
z(), num_kernels);
66 weights.allocator()->init(
TensorInfo(weights_shape, 1, data_type));
71 conv.configure(&
src, &weights, &bias, &
dst, pad_info);
74 src.allocator()->allocate();
75 weights.allocator()->allocate();
76 bias.allocator()->allocate();
77 dst.allocator()->allocate();
92 void do_run()
override 97 void do_teardown()
override 112 const std::pair<unsigned int, unsigned int> scaled_dims =
scaled_dimensions(in_shape.
x(),
117 out_shape.set(0, scaled_dims.first);
118 out_shape.set(1, scaled_dims.second);
119 out_shape.set(2, kernel_shape[3]);
129 int main(
int argc,
char **argv)
131 return utils::run_example<GCDCExample>(argc, argv);
half_float::half half
16-bit floating point type
Basic function to execute direct convolution function.
Interface for OpenGL ES tensor.
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
std::pair< unsigned int, unsigned int > scaled_dimensions(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
Returns expected width and height of output scaled tensor depending on dimensions rounding mode...
T x() const
Alias to access the size of the first dimension.
static GCScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
T z() const
Alias to access the size of the third dimension.
Padding and stride information class.
int main(int argc, char **argv)
Main program for directconvolution test.
Includes all the OpenGLES functions at once.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Interface to enqueue GLES kernels and get/set the GLES CommandQueue.
Store the tensor's metadata.
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
T y() const
Alias to access the size of the second dimension.
Iterator updated by execute_window_loop for each window element.
DataType
Available data types.
Describe a multidimensional execution window.
void default_init()
Initialises the context and command queue used by the scheduler to default values and sets a default ...