Skip to content

set zero point to 0 if all value are 0.0#12470

Merged
yufenglee merged 3 commits intomasterfrom
yufeng/zp_0
Aug 8, 2022
Merged

set zero point to 0 if all value are 0.0#12470
yufenglee merged 3 commits intomasterfrom
yufeng/zp_0

Conversation

@yufenglee
Copy link
Member

No description provided.

scale = (rmax - rmin) / float(qmax - qmin) if rmax != rmin else 1.0
zero_point = round(qmin - rmin / scale)
if rmax == rmin:
scale = 1.0
Copy link
Contributor

Choose a reason for hiding this comment

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

is this meant to be if (rmax-rmin) <= tiny_float?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible we have a corner case where rmax == rmin == 0.5 or some other normal fp32 value?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, there will be no this case because rmin <=0 and rmax >=0.

@yufenglee yufenglee merged commit bdd6b00 into master Aug 8, 2022
@yufenglee yufenglee deleted the yufeng/zp_0 branch August 8, 2022 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants