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 void 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);
62 const TensorShape dst_shape = get_output_shape(src_shape, weights_shape, pad_info);
66 weights.allocator()->init(
TensorInfo(weights_shape, 1, data_type));
67 bias.allocator()->init(
TensorInfo(bias_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();
90 void do_run()
override 95 void do_teardown()
override 110 const std::pair<unsigned int, unsigned int> scaled_dims =
scaled_dimensions(in_shape.
x(),
115 out_shape.set(0, scaled_dims.first);
116 out_shape.set(1, scaled_dims.second);
117 out_shape.set(2, kernel_shape[3]);
127 int main(
int argc,
char **argv)
129 return utils::run_example<GCDCExample>(argc, argv);
CLTensorAllocator * allocator()
Return a pointer to the tensor's allocator.
T z() const
Alias to access the size of the third dimension.
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.
src info() -> set_format(Format::S16)
This file contains all available output stages for GEMMLowp on OpenCL.
1 channel, 1 F16 per channel
void map(bool blocking=true)
Enqueue a map operation of the allocated buffer.
T x() const
Alias to access the size of the first dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
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...
Padding and stride information class.
int main(int argc, char **argv)
Main program for directconvolution test.
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
T y() const
Alias to access the size of the second dimension.
void init(const TensorInfo &input)
Initialize a tensor based on the passed TensorInfo.
const std::pair< unsigned int, unsigned int > scaled_dimensions(unsigned int width, unsigned int height, unsigned int kernel_width, unsigned 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...
Store the tensor's metadata.
Iterator updated by execute_window_loop for each window element.
DataType
Available data types.
void unmap()
Enqueue an unmap operation of the allocated and mapped buffer.
static GCScheduler & get()
Access the scheduler singleton.
Describe a multidimensional execution window.
convolution configure & src
void default_init()
Initialises the context and command queue used by the scheduler to default values and sets a default ...