24.02.1
|
Go to the documentation of this file.
28 #include "utils/Utils.h"
34 using namespace utils;
36 class NEONCopyObjectsExample :
public Example
39 bool do_setup(
int argc,
char **argv)
override
45 constexpr
unsigned int width = 4;
46 constexpr
unsigned int height = 3;
47 constexpr
unsigned int batch = 2;
49 src_data =
new float[width * height * batch];
50 dst_data =
new float[width * height * batch];
53 for (
unsigned int b = 0;
b < batch;
b++)
55 for (
unsigned int h = 0; h < height; h++)
57 for (
unsigned int w = 0;
w < width;
w++)
59 src_data[
b * (width * height) + h * width +
w] =
static_cast<float>(100 *
b + 10 * h +
w);
70 softmax.configure(&
input, &output);
73 input.allocator()->allocate();
74 output.allocator()->allocate();
80 std::cout <<
" Dimensions of the input's iterator:\n";
81 std::cout <<
" X = [start=" << input_window.
x().
start() <<
", end=" << input_window.
x().
end()
82 <<
", step=" << input_window.
x().
step() <<
"]\n";
83 std::cout <<
" Y = [start=" << input_window.
y().
start() <<
", end=" << input_window.
y().
end()
84 <<
", step=" << input_window.
y().
step() <<
"]\n";
85 std::cout <<
" Z = [start=" << input_window.
z().
start() <<
", end=" << input_window.
z().
end()
86 <<
", step=" << input_window.
z().
step() <<
"]\n";
108 std::cout <<
"Setting item [" <<
id.x() <<
"," <<
id.y() <<
"," <<
id.z() <<
"]\n";
109 *
reinterpret_cast<float *
>(input_it.ptr()) =
110 src_data[
id.z() * (width * height) +
id.y() * width +
id.x()];
117 output.info()->tensor_shape(),
119 std::cout <<
" Dimensions of the output's iterator:\n";
120 std::cout <<
" X = [start=" << output_window.x().start() <<
", end=" << output_window.x().end()
121 <<
", step=" << output_window.x().step() <<
"]\n";
122 std::cout <<
" Y = [start=" << output_window.y().start() <<
", end=" << output_window.y().end()
123 <<
", step=" << output_window.y().step() <<
"]\n";
124 std::cout <<
" Z = [start=" << output_window.z().start() <<
", end=" << output_window.z().end()
125 <<
", step=" << output_window.z().step() <<
"]\n";
128 Iterator output_it(&output, output_window);
144 std::cout <<
"Copying one row starting from [" <<
id.x() <<
"," <<
id.y() <<
"," <<
id.z() <<
"]\n";
146 memcpy(dst_data +
id.z() * (width * height) +
id.y() * width, output_it.ptr(), width *
sizeof(
float));
154 void do_run()
override
159 void do_teardown()
override
176 int main(
int argc,
char **argv)
178 return utils::run_example<NEONCopyObjectsExample>(argc, argv);
constexpr int start() const
Return the start of the dimension.
constexpr int step() const
Return the step of the dimension.
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
Basic function to compute a SoftmaxLayer and a Log SoftmaxLayer.
Includes all the Arm® Neon™ functions at once.
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...
Iterator updated by execute_window_loop for each window element.
constexpr const Dimension & y() const
Alias to access the second dimension of the window.
int main(int argc, char **argv)
Main program for the copy objects test.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Store the tensor's metadata.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
@ F32
32-bit floating-point number
Basic implementation of the tensor interface.
constexpr int end() const
Return the end of the dimension.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
constexpr const Dimension & z() const
Alias to access the third dimension of the window.