Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/clamp-other-datatype-input-s…
Browse files Browse the repository at this point in the history
…upport' into fix/clamp-other-datatype-input-support
  • Loading branch information
hejunchao committed Aug 8, 2023
2 parents 982147f + fb7862c commit cdb9bc4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Native/include/nncase/runtime/half.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct half {
std::is_floating_point<T>::value>>
explicit half(const T &val) noexcept : half(static_cast<float>(val)) {}

half(int&& val) noexcept : half(static_cast<float>(val)) {}
half(int &&val) noexcept : half(static_cast<float>(val)) {}

constexpr half(fp16_from_raw_t, uint16_t value) noexcept : value_(value) {}

Expand Down Expand Up @@ -158,7 +158,7 @@ struct half {
return (value_ & 0x7FFF) == ZERO_VALUE;
}

void operator=(const float & v) noexcept {
void operator=(const float &v) noexcept {
value_ = (round_to_half(v).value_);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Native/include/nncase/runtime/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ inline bool is_contiguous(tensor tensor) {
case dt_float32: \
_impl(float); \
case dt_float16: \
_impl(half); \
_impl(half); \
case dt_int8: \
_impl(int8_t); \
case dt_int16: \
Expand Down
7 changes: 3 additions & 4 deletions tests/kernels/test_clamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ using namespace nncase;
using namespace nncase::runtime;
using namespace ortki;

class ClampTest
: public KernelTest,
public ::testing::TestWithParam<
std::tuple<nncase::typecode_t, dims_t, float, float>> {
class ClampTest : public KernelTest,
public ::testing::TestWithParam<
std::tuple<nncase::typecode_t, dims_t, float, float>> {
public:
void SetUp() override {
auto &&[typecode, l_shape, value1, value2] = GetParam();
Expand Down
2 changes: 1 addition & 1 deletion tests/kernels/test_conv2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ TEST_P(Conv2DTest, conv2d) {
int64_t group[] = {group_value};

float fused_clamp[] = {-std::numeric_limits<float>::infinity(),
std::numeric_limits<float>::infinity()};
std::numeric_limits<float>::infinity()};

auto dilations_ptr = hrt::create(nncase::dt_int64, {2},
{reinterpret_cast<gsl::byte *>(dilations),
Expand Down
2 changes: 1 addition & 1 deletion tests/kernels/test_space_to_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SpaceToBatchTest

// expected
float expected_array[] = {1, 3, 9, 11, 2, 4, 10, 12,
5, 7, 13, 15, 6, 8, 14, 16};
5, 7, 13, 15, 6, 8, 14, 16};
expected = hrt::create(typecode, l_shape,
{reinterpret_cast<gsl::byte *>(expected_array),
sizeof(expected_array)},
Expand Down
4 changes: 2 additions & 2 deletions tests/kernels/test_uniform_like.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ using namespace ortki;

class UniformLikeTest
: public KernelTest,
public ::testing::TestWithParam<std::tuple<
nncase::typecode_t, dims_t, dims_t, float, float, float>> {
public ::testing::TestWithParam<
std::tuple<nncase::typecode_t, dims_t, dims_t, float, float, float>> {
public:
void SetUp() override {
auto &&[typecode, shape, l_shape, value1, value2, value3] = GetParam();
Expand Down

0 comments on commit cdb9bc4

Please sign in to comment.