Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
consistent float literals
  • Loading branch information
tdakhran committed Nov 28, 2025
commit 215388f2161bf502e7fa07148ece1a029706a8bf
10 changes: 5 additions & 5 deletions ggml/src/ggml-cpu/ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7424,14 +7424,14 @@ static void ggml_compute_forward_upscale_f32(
// Similar to F.interpolate(..., mode="bilinear", align_corners=False, antialias=True)
// https://github.com/pytorch/pytorch/blob/8871ff29b743948d1225389d5b7068f37b22750b/aten/src/ATen/native/cpu/UpSampleKernel.cpp
auto triangle_filter = [](float x) -> float {
return std::max(1.0f - fabsf(x), 0.f);
return std::max(1.0f - fabsf(x), 0.0f);
};

// support and invscale, maximum 1 pixel for bilinear
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall be minimum in the comment

const float support1 = std::max(1.f, 1.f / sf1);
const float invscale1 = 1.0 / support1;
const float support0 = std::max(1.f, 1.f / sf0);
const float invscale0 = 1.f / support0;
const float support1 = std::max(1.0f, 1.0f / sf1);
const float invscale1 = 1.0f / support1;
const float support0 = std::max(1.0f, 1.0f / sf0);
const float invscale0 = 1.0f / support0;

for (int64_t i3 = 0; i3 < ne3; i3++) {
const int64_t i03 = i3 / sf3;
Expand Down
10 changes: 5 additions & 5 deletions ggml/src/ggml-cuda/upscale.cu
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ static __global__ void upscale_f32_bilinear_antialias(const float * src0, float
const float x = ((float)i10_dst + pixel_offset) / sf0;

// support and invscale, maximum 1 pixel for bilinear
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall be minimum in the comment

const float support1 = max(1.f / sf1, 1.f);
const float invscale1 = 1.0 / support1;
const float support0 = max(1.f / sf0, 1.f);
const float invscale0 = 1.f / support0;
const float support1 = max(1.0f / sf1, 1.0f);
const float invscale1 = 1.0f / support1;
const float support0 = max(1.0f / sf0, 1.0f);
const float invscale0 = 1.0f / support0;

// the range of source pixels that contribute
const int64_t x_min = max(int64_t(0), int64_t(x - support0 + pixel_offset));
Expand All @@ -124,7 +124,7 @@ static __global__ void upscale_f32_bilinear_antialias(const float * src0, float
float total_weight = 0.0f;

auto triangle_filter = [](float x) -> float {
return max(1.0f - fabsf(x), 0.f);
return max(1.0f - fabsf(x), 0.0f);
};

for (int64_t sy = y_min; sy < y_max; sy++) {
Expand Down