59 auto data = std::make_unique<uint8_t[]>(total_size);
69 const size_t required_alignment = 339;
77 t3.allocator()->set_associated_memory_group(&mg);
87 t4.allocator()->free();
100 const size_t required_alignment = 64;
106 act_func.
configure(&tensor,
nullptr, act_info);
111 size_t space = total_size_in_bytes + required_alignment;
112 auto raw_data = std::make_unique<uint8_t[]>(space);
114 void *aligned_ptr = raw_data.get();
115 std::align(required_alignment, total_size_in_bytes, aligned_ptr, space);
121 std::uniform_real_distribution<float>
distribution(-5.f, 5.f);
122 std::mt19937 gen(
library->seed());
123 auto *typed_ptr =
reinterpret_cast<float *
>(aligned_ptr);
124 for(
unsigned int i = 0; i < total_size_in_elems; ++i)
133 for(
unsigned int i = 0; i < total_size_in_elems; ++i)
161 auto raw_data = std::make_unique<uint8_t[]>(total_size_in_bytes);
167 std::uniform_real_distribution<float>
distribution(-5.f, 5.f);
168 std::mt19937 gen(
library->seed());
172 Iterator tensor_it(&tensor, tensor_window);
186 const float val = *
reinterpret_cast<float *
>(tensor_it.
ptr());
196 #if !defined(BARE_METAL) 210 act_func.
configure(&tensor,
nullptr, act_info);
217 std::ofstream output_file(
"test_mmap_import.bin", std::ios::binary | std::ios::out);
218 output_file.seekp(total_size_in_bytes - 1);
219 output_file.write(
"", 1);
225 unsigned char *data = mmapped_file.
data();
232 std::uniform_real_distribution<float>
distribution(-5.f, 5.f);
233 std::mt19937 gen(
library->seed());
234 auto *typed_ptr =
reinterpret_cast<float *
>(data);
235 for(
unsigned int i = 0; i < total_size_in_elems; ++i)
244 for(
unsigned int i = 0; i < total_size_in_elems; ++i)
253 #endif // !defined(BARE_METAL) 259 const size_t requested_alignment = 1024;
#define ARM_COMPUTE_ASSERT(cond)
void init(const TensorAllocator &allocator, const Coordinates &coords, TensorInfo &sub_info)
Shares the same backing memory with another tensor allocator, while the tensor info might be differen...
Container for 2D border size.
1 channel, 1 F32 per channel
ARM_COMPUTE_EXPECT(has_error==expected, framework::LogLevel::ERRORS)
Memory mapped file class.
Activation Layer Information class.
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
Copyright (c) 2017-2022 Arm Limited.
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
DatasetMode
Possible dataset modes.
std::unique_ptr< AssetsLibrary > library
void run() override
Run the kernels contained in the function.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
[CLActivationLayer Test snippet]
size_t total_size() const override
Returns the total size of the tensor in bytes.
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
size_t total_size() const
Collapses all dimensions to a single linear total size.
size_t alignment() const
Return underlying's tensor buffer alignment.
bool is_mapped() const
Checks if file mapped.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
Basic implementation of the tensor interface.
validate(CLAccessor(output_state), expected_output)
virtual PaddingSize padding() const =0
Padding of tensor.
std::uniform_real_distribution< float > distribution(-5.f, 5.f)
void free() override
Free allocated CPU memory.
unsigned char * data()
Mapped data accessor.
Basic function to run cpu::kernels::CpuActivationKernel.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
void configure(ITensor *input, ITensor *output, ActivationLayerInfo activation_info)
[NEActivationLayer snippet]
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory. ...
Status import_memory(void *memory)
Import an existing memory as a tensor's backing memory.
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...
TEST_CASE(FusedActivation, framework::DatasetMode::ALL)
Validate fused activation expecting the following behaviours:
Iterator updated by execute_window_loop for each window element.
TEST_SUITE(QASYMM8_to_F32) FIXTURE_DATA_TEST_CASE(RunSmall
DataType
Available data types.
virtual bool extend_padding(const PaddingSize &padding)=0
Update the offset to the first element, the strides and the total size.
Describe a multidimensional execution window.
bool check_aligned(void *ptr, const size_t alignment)
Checks if a pointer complies with a given alignment.