Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions kernels/portable/cpu/op_allclose.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
* Copyright 2025 Arm Limited and/or its affiliates.
* Copyright 2025-2026 Arm Limited and/or its affiliates.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -41,8 +41,8 @@ bool data_is_close(
return false;
}
} else {
auto allowed_error = atol + fabs(rtol * b[i]);
auto actual_error = fabs(a[i] - b[i]);
auto allowed_error = atol + std::fabs(rtol * b[i]);
auto actual_error = std::fabs(a[i] - b[i]);
if (!std::isfinite(actual_error) || actual_error > allowed_error) {
return false;
}
Expand Down
11 changes: 7 additions & 4 deletions kernels/portable/cpu/util/upsample_util.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
* Copyright 2026 Arm Limited and/or its affiliates.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

#pragma once

#include <cmath>

#include <executorch/runtime/core/exec_aten/exec_aten.h>
#include <executorch/runtime/core/exec_aten/util/tensor_util.h>
#include <executorch/runtime/kernel/kernel_includes.h>
Expand Down Expand Up @@ -98,8 +101,8 @@ inline void guard_index_and_lambda(
const int64_t& input_size,
int64_t& input_index,
scalar_t& lambda) {
input_index =
std::min(static_cast<int64_t>(floorf(real_input_index)), input_size - 1);
input_index = std::min(
static_cast<int64_t>(std::floor(real_input_index)), input_size - 1);
lambda = std::min(
std::max(real_input_index - input_index, static_cast<opmath_t>(0)),
static_cast<opmath_t>(1));
Expand Down Expand Up @@ -140,8 +143,8 @@ inline int64_t nearest_neighbor_compute_source_index(
int64_t input_size) {
// Index computation matching OpenCV INTER_NEAREST
// which is buggy and kept for BC
const int64_t src_index =
std::min(static_cast<int64_t>(floorf(dst_index * scale)), input_size - 1);
const int64_t src_index = std::min(
static_cast<int64_t>(std::floor(dst_index * scale)), input_size - 1);
return src_index;
}

Expand Down
6 changes: 3 additions & 3 deletions kernels/portable/cpu/vec_ops.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
* Copyright 2024 Arm Limited and/or its affiliates.
* Copyright 2024,2026 Arm Limited and/or its affiliates.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -201,7 +201,7 @@ inline void vec_softmax(T* ET_RESTRICT y, const U* ET_RESTRICT x, int n) {
T sum = 0;

for (const auto i : c10::irange(n)) {
y[i] = expf(x[i] - max_x);
y[i] = std::exp(x[i] - max_x);
sum += y[i];
}

Expand Down Expand Up @@ -230,7 +230,7 @@ inline void quantize_i8_f32(
int32_t zero_point,
size_t size) {
for (const auto i : c10::irange(size)) {
float tmp = roundf(x[i] * scale + zero_point);
float tmp = std::round(x[i] * scale + zero_point);
y[i] = internal::clamp(tmp, -128.f, 127.f);
}
}
Expand Down
Loading