24.02.1
|
Go to the documentation of this file.
58 const size_t total_size =
info.total_size();
59 auto data = std::make_unique<uint8_t[]>(total_size);
69 const size_t required_alignment = 339;
100 const size_t required_alignment = 64;
102 tensor.allocator()->init(
info, required_alignment);
109 const size_t total_size_in_elems =
tensor.info()->tensor_shape().total_size();
110 const size_t total_size_in_bytes =
tensor.info()->total_size();
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)
139 tensor.allocator()->free();
152 tensor.info()->extend_padding(enforced_padding);
160 const size_t total_size_in_bytes =
tensor.info()->total_size();
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());
186 const float val = *
reinterpret_cast<float *
>(tensor_it.
ptr());
192 tensor.allocator()->free();
196 #if !defined(_WIN64) && !defined(BARE_METAL)
213 const size_t total_size_in_elems =
tensor.info()->tensor_shape().total_size();
214 const size_t total_size_in_bytes =
tensor.info()->total_size();
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)
250 tensor.allocator()->free();
253 #endif // !defined(_WIN64) && !defined(BARE_METAL)
259 const size_t requested_alignment = 1024;
262 t.allocator()->init(
info, requested_alignment);
263 t.allocator()->allocate();
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
[CLActivationLayer Test snippet]
TEST_CASE(FusedActivation, framework::DatasetMode::ALL)
Validate fused activation expecting the following behaviours:
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...
Memory mapped file class.
Container for 2D border size.
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
TEST_SUITE(QASYMM8_to_F32) FIXTURE_DATA_TEST_CASE(RunSmall
Activation Layer Information class.
validate(CLAccessor(output_state), expected_output)
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
void configure(ITensor *input, ITensor *output, ActivationLayerInfo activation_info)
[NEActivationLayer snippet]
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
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...
ARM_COMPUTE_EXPECT(has_error==expected, framework::LogLevel::ERRORS)
Iterator updated by execute_window_loop for each window element.
bool check_aligned(void *ptr, const size_t alignment)
Checks if a pointer complies with a given alignment.
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory.
Basic function to run cpu::kernels::CpuActivationKernel.
#define ARM_COMPUTE_ASSERT(cond)
CLTensor * tensor
Pointer to the auxiliary tensor.
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
void set_associated_memory_group(IMemoryGroup *associated_memory_group)
Associates the tensor with a memory group.
std::unique_ptr< AssetsLibrary > library
Store the tensor's metadata.
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
std::uniform_real_distribution< float > distribution(-5.f, 5.f)
void free() override
Free allocated CPU memory.
@ F32
32-bit floating-point number
Basic implementation of the tensor interface.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
void run() override
Run the kernels contained in the function.
Status import_memory(void *memory)
Import an existing memory as a tensor's backing memory.
DatasetMode
Possible dataset modes.
DataType
Available data types.