Skip to content

Support Add, Relu in InsertQuantizeOpOnDtypeMismatch#166

Merged
mhs4670go merged 2 commits into
Samsung:mainfrom
jinevening:insert_quantize_op_relu_add
Jun 30, 2025
Merged

Support Add, Relu in InsertQuantizeOpOnDtypeMismatch#166
mhs4670go merged 2 commits into
Samsung:mainfrom
jinevening:insert_quantize_op_relu_add

Conversation

@jinevening

Copy link
Copy Markdown
Contributor

This adds Add, Relu in InsertQuantizeOpOnDtypeMismatch.

TICO-DCO-1.0-Signed-off-by: Hyukjin Jeong hj1.jeong@samsung.com


Related to: #165

This adds Add, Relu in InsertQuantizeOpOnDtypeMismatch.

TICO-DCO-1.0-Signed-off-by: Hyukjin Jeong <hj1.jeong@samsung.com>
min_ = u8_scale * (-u8_zerop)

abs_max = max([max_, min_], key=abs)
abs_max = abs(max([max_, min_], key=abs))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This line fixes a bug. Without this change, scale can be a negative value.

@jinevening jinevening requested a review from a team June 20, 2025 05:08
mhs4670go
mhs4670go previously approved these changes Jun 20, 2025

@mhs4670go mhs4670go left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM


if qparam_dtype(x) == "int16" and qparam_dtype(node) == "uint8":
quantize = _insert_quantize_op_after(node)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it okay without checking qparam_dtype(y)? What if one of x and y get folded in another pass and dtype gets differ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds reasonable. I will add a check for that case.

@mhs4670go mhs4670go left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@dayo09 dayo09 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mhs4670go mhs4670go merged commit 535d750 into Samsung:main Jun 30, 2025
5 checks passed
@jinevening jinevening deleted the insert_quantize_op_relu_add branch June 30, 2025 11:59
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.

3 participants