Skip to content

Commit

Permalink
Minor fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yuslepukhin committed Feb 22, 2024
1 parent deddf7f commit 6308d29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/cpu/tensor/upsamplebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class UpsampleBase {
// we need to handle negative values
// it's equivalent to :x = np.clip(x, 0, 255) where x \in [-640, 639]
// we will accept a negative x for (&table[640])[x] means table +640 -x
for (int i = 0; i < kLookupTableSize; ++i) {
for (int i = 0; i < static_cast<int>(kLookupTableSize); ++i) {
table[i] = static_cast<uint8_t>(std::min(std::max(i - 640, 0), 255));

Check warning on line 573 in onnxruntime/core/providers/cpu/tensor/upsamplebase.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Add #include <algorithm> for min [build/include_what_you_use] [4] Raw Output: onnxruntime/core/providers/cpu/tensor/upsamplebase.h:573: Add #include <algorithm> for min [build/include_what_you_use] [4]
}
return table;
Expand Down
10 changes: 2 additions & 8 deletions onnxruntime/core/providers/cuda/tensor/resize_antialias_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ __global__ void _ComputeInterpolationAtLevel1(
}
}

// std::cout << output << ' ';

if constexpr (onnxruntime::is_8bit_v<T>) {
const uint8_t* clip8_lookups = &clip8_table[640];
*Ydata_offset = static_cast<T>(clip8_lookups[output >> 22]);
Expand Down Expand Up @@ -244,8 +242,6 @@ __global__ void _ComputeInterpolationAtLevel2(
Xdata_offset += input_width;
}

// std::cout << output << ' ';

if constexpr (onnxruntime::is_8bit_v<T>) {
const uint8_t* clip8_lookups = &clip8_table[640];
*Ydata_offset = static_cast<T>(clip8_lookups[output >> 22]);
Expand Down Expand Up @@ -301,13 +297,13 @@ __global__ void _ComputeInterpolationAtLevel3(
}

// Extrapolate along the y dimension
const auto* y_outof_bounds = std::get<2>(outof_bounds_buffers);
const auto* y_outof_bounds = std::get<1>(outof_bounds_buffers);
if (y_outof_bounds[static_cast<ptrdiff_t>(output_y)] != -1) {
*Ydata_offset = static_cast<T>(extrapolation_value);
return;
}

// Extrapolate along the y dimension
// Extrapolate along the z dimension
const int64_t* z_outof_bounds = std::get<0>(outof_bounds_buffers);
if (z_outof_bounds != nullptr && z_outof_bounds[static_cast<ptrdiff_t>(output_z)] != -1) {
*Ydata_offset = static_cast<T>(extrapolation_value);
Expand Down Expand Up @@ -336,8 +332,6 @@ __global__ void _ComputeInterpolationAtLevel3(
Xdata_offset += z_step;
}

// std::cout << output << ' ';

if constexpr (onnxruntime::is_8bit_v<T>) {
const uint8_t* clip8_lookups = &clip8_table[640];
*Ydata_offset = static_cast<T>(clip8_lookups[output >> 22]);
Expand Down

0 comments on commit 6308d29

Please sign in to comment.