Skip to content

Commit

Permalink
Fix histogram bug in libpymo
Browse files Browse the repository at this point in the history
Signed-off-by: Kyunggeun Lee <[email protected]>
  • Loading branch information
quic-kyunggeu committed Jan 15, 2025
1 parent ec09a37 commit 48cb4df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ModelOptimizations/DlQuantization/src/math_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void GetHistogram_cpu(const DTYPE* data, int cnt, uint32_t histogram[PDF_SIZE],
{
// Map a floating point number to the appropriate bucket.
int index =
is_signed ? round(data[i] / bucket_size - pdf_offset) : round(std::abs(data[i]) / bucket_size - pdf_offset);
is_signed ? floor(data[i] / bucket_size - pdf_offset) : floor(std::abs(data[i]) / bucket_size - pdf_offset);

// Add to histogram, if inside the histogram range.
if (index >= 0 && index < PDF_SIZE)
Expand Down
4 changes: 2 additions & 2 deletions ModelOptimizations/DlQuantization/src/math_functions.cu
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ __global__ static void histogramCountKernel(const DTYPE* data,
{
// Map a floating point number to the appropriate bucket.
int index = is_signed ?
round(data[i] / bucket_size - histogram_offset) :
round(abs(data[i]) / bucket_size - histogram_offset);
floor(data[i] / bucket_size - histogram_offset) :
floor(abs(data[i]) / bucket_size - histogram_offset);

// Add to histogram, if inside the histogram range.
if (index >= 0 && index < PDF_SIZE)
Expand Down

0 comments on commit 48cb4df

Please sign in to comment.