diff options
author | Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-27 17:46:17 +0100 |
---|---|---|
committer | felixjohnny.thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-28 12:08:05 +0000 |
commit | afd38f0c617d6f89b2b4532c6c44f116617e2b6f (patch) | |
tree | 03bc7d5a762099989b16a656fa8d397b490ed70e /src/core/ITensor.cpp | |
parent | bdcb4c148ee2fdeaaddf4cf1e57bbb0de02bb894 (diff) | |
download | ComputeLibrary-afd38f0c617d6f89b2b4532c6c44f116617e2b6f.tar.gz |
Apply clang-format on repository
Code is formatted as per a revised clang format configuration
file(not part of this delivery). Version 14.0.6 is used.
Exclusion List:
- files with .cl extension
- files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...)
And the following directories
- compute_kernel_writer/validation/
- tests/
- include/
- src/core/NEON/kernels/convolution/
- src/core/NEON/kernels/arm_gemm/
- src/core/NEON/kernels/arm_conv/
- data/
There will be a follow up for formatting of .cl files and the
files under tests/ and compute_kernel_writer/validation/.
Signed-off-by: Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com>
Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Diffstat (limited to 'src/core/ITensor.cpp')
-rw-r--r-- | src/core/ITensor.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/core/ITensor.cpp b/src/core/ITensor.cpp index 2f4354cc6f..4dc8ea959b 100644 --- a/src/core/ITensor.cpp +++ b/src/core/ITensor.cpp @@ -35,7 +35,7 @@ namespace arm_compute { void ITensor::copy_from(const ITensor &src) { - if(&src == this) + if (&src == this) { return; } @@ -47,7 +47,7 @@ void ITensor::copy_from(const ITensor &src) ARM_COMPUTE_ERROR_ON(src_info->num_channels() != dst_info->num_channels()); ARM_COMPUTE_ERROR_ON(src_info->element_size() != dst_info->element_size()); - for(size_t d = 0; d < src_info->num_dimensions(); d++) + for (size_t d = 0; d < src_info->num_dimensions(); d++) { ARM_COMPUTE_ERROR_ON(src_info->dimension(d) > dst_info->dimension(d)); } @@ -66,11 +66,7 @@ void ITensor::copy_from(const ITensor &src) const size_t line_size = src_info->element_size() * src_info->dimension(0); execute_window_loop( - win_src, [&](const Coordinates &) - { - memcpy(dst_it.ptr(), src_it.ptr(), line_size); - }, - src_it, dst_it); + win_src, [&](const Coordinates &) { memcpy(dst_it.ptr(), src_it.ptr(), line_size); }, src_it, dst_it); } #ifdef ARM_COMPUTE_ASSERTS_ENABLED @@ -87,10 +83,10 @@ void ITensor::print(std::ostream &s, IOFormatInfo io_fmt) const stream_status.copyfmt(s); // Set precision - if(is_data_type_float(dt) && (io_fmt.precision_type != IOFormatInfo::PrecisionType::Default)) + if (is_data_type_float(dt) && (io_fmt.precision_type != IOFormatInfo::PrecisionType::Default)) { int precision = io_fmt.precision; - if(io_fmt.precision_type == IOFormatInfo::PrecisionType::Full) + if (io_fmt.precision_type == IOFormatInfo::PrecisionType::Full) { precision = std::numeric_limits<float>().max_digits10; } @@ -101,7 +97,7 @@ void ITensor::print(std::ostream &s, IOFormatInfo io_fmt) const size_t print_width = 0; size_t print_height = 0; int start_offset = 0; - switch(io_fmt.print_region) + switch (io_fmt.print_region) { case IOFormatInfo::PrintRegion::NoPadding: print_width = this->info()->dimension(0); @@ -111,13 +107,14 @@ void ITensor::print(std::ostream &s, IOFormatInfo io_fmt) const case IOFormatInfo::PrintRegion::ValidRegion: print_width = this->info()->valid_region().shape.x(); print_height = this->info()->valid_region().shape.y(); - start_offset = this->info()->offset_element_in_bytes(Coordinates(this->info()->valid_region().anchor.x(), - this->info()->valid_region().anchor.y())); + start_offset = this->info()->offset_element_in_bytes( + Coordinates(this->info()->valid_region().anchor.x(), this->info()->valid_region().anchor.y())); break; case IOFormatInfo::PrintRegion::Full: print_width = padding.left + this->info()->dimension(0) + padding.right; print_height = padding.top + this->info()->dimension(1) + padding.bottom; - start_offset = static_cast<int>(this->info()->offset_first_element_in_bytes()) - padding.top * strides[1] - padding.left * strides[0]; + start_offset = static_cast<int>(this->info()->offset_first_element_in_bytes()) - padding.top * strides[1] - + padding.left * strides[0]; break; default: break; @@ -129,16 +126,17 @@ void ITensor::print(std::ostream &s, IOFormatInfo io_fmt) const const uint8_t *ptr = this->buffer() + start_offset; // Start printing - for(size_t i = 0; i < slices2D; ++i) + for (size_t i = 0; i < slices2D; ++i) { // Find max_width of elements in slice to align columns int max_element_width = 0; - if(io_fmt.align_columns) + if (io_fmt.align_columns) { size_t offset = i * strides[2]; - for(size_t h = 0; h < print_height; ++h) + for (size_t h = 0; h < print_height; ++h) { - max_element_width = std::max<int>(max_element_width, max_consecutive_elements_display_width(s, dt, ptr + offset, print_width)); + max_element_width = std::max<int>( + max_element_width, max_consecutive_elements_display_width(s, dt, ptr + offset, print_width)); offset += strides[1]; } } @@ -146,7 +144,7 @@ void ITensor::print(std::ostream &s, IOFormatInfo io_fmt) const // Print slice { size_t offset = i * strides[2]; - for(size_t h = 0; h < print_height; ++h) + for (size_t h = 0; h < print_height; ++h) { print_consecutive_elements(s, dt, ptr + offset, print_width, max_element_width, io_fmt.element_delim); offset += strides[1]; |