Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copybara import of the project: #7510

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 src/reference/unary-elementwise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ template <typename T>
struct AbsOp {
explicit AbsOp(const xnn_unary_uparams*) {}

int operator()(int x) const { return std::abs(x); }
int32_t operator()(int32_t x) const { return std::abs(x); }
float operator()(float x) const { return std::abs(x); }
xnn_float16 operator()(xnn_float16 x) const {
return xnn_float16_from_bits(xnn_float16_to_bits(x) & 0x7fff);
Expand Down Expand Up @@ -298,7 +298,7 @@ struct NegateOp {
explicit NegateOp(const xnn_unary_uparams*) {}

static const uint16_t sign_mask = 0x8000;
int operator()(int x) const { return -x; }
int32_t operator()(int32_t x) const { return -x; }
float operator()(float x) const { return -x; }
xnn_float16 operator()(xnn_float16 x) const {
return xnn_float16_from_bits(xnn_float16_to_bits(x) ^ sign_mask);
Expand Down Expand Up @@ -464,7 +464,7 @@ template <typename T>
struct SignOp {
explicit SignOp(const xnn_unary_uparams*) {}

int operator()(int x) const { return x < 0 ? -1 : x > 0 ? 1 : 0; }
int32_t operator()(int32_t x) const { return x < 0 ? -1 : x > 0 ? 1: 0; }
float operator()(float x) const { return x < 0 ? -1 : x > 0 ? 1 : 0; }

static const uint16_t sign_mask = 0x8000;
Expand Down
2 changes: 1 addition & 1 deletion src/xnnpack/reference-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ T euclidean_mod(T a, T b) {
template <typename T>
T integer_pow(T a, T b) {
if (b < 0) {
return euclidean_div(1, integer_pow(a, -b));
return euclidean_div<T>(1, integer_pow(a, -b));
}
T result = 1;
for (; b; b >>= 1) {
Expand Down
4 changes: 2 additions & 2 deletions test/binary-elementwise-nd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,13 @@ class BinaryElementwiseOperatorTester {
i * input1_strides[0] + j * input1_strides[1] +
k * input1_strides[2] + l * input1_strides[3] +
m * input1_strides[4] + n * input1_strides[5];
const int input1_value =
const int32_t input1_value =
reinterpret_cast<const T*>(&input1[0])[input1_index];
const size_t input2_index =
i * input2_strides[0] + j * input2_strides[1] +
k * input2_strides[2] + l * input2_strides[3] +
m * input2_strides[4] + n * input2_strides[5];
const int input2_value =
const int32_t input2_value =
reinterpret_cast<const T*>(&input2[0])[input2_index];
int output_ref = Compute(input1_value, input2_value);
if (std::isnan(output_ref) || output_ref < limits.low ||
Expand Down