Skip to content

Support fake-quantized linear with fp32 bias#154

Merged
mhs4670go merged 1 commit intoSamsung:mainfrom
jinevening:fq_linear_fp32_bias
Jun 18, 2025
Merged

Support fake-quantized linear with fp32 bias#154
mhs4670go merged 1 commit intoSamsung:mainfrom
jinevening:fq_linear_fp32_bias

Conversation

@jinevening
Copy link
Contributor

@jinevening jinevening commented Jun 17, 2025

This supports fake-quantized linear with fp32 bias.

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


Related to: #149, #165

return (torch.randn(3, 3), None)


@test_without_inference
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this tag. A test with this tag stops before inference.


# TODO Support more ops.

graph.eliminate_dead_code()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO We need to eliminate lifted constant tensor placeholder.

This supports fake-quantized linear with fp32 bias.

TICO-DCO-1.0-Signed-off-by: Hyukjin Jeong <hj1.jeong@samsung.com>
@jinevening jinevening force-pushed the fq_linear_fp32_bias branch from e87b415 to d9c147c Compare June 17, 2025 07:27
Comment on lines +68 to +69
if bias_val.dtype != torch.float32:
continue
Copy link
Contributor

@dayo09 dayo09 Jun 17, 2025

Choose a reason for hiding this comment

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

I just wonder if this bias quantization is not required for torch.float64 case?.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've not seen fp64 bias so far. Most quantization frameworks use fp32 by default and partially support fp16. It would be possible to support another type when necessary.

Copy link
Contributor

@mhs4670go mhs4670go left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@dayo09 dayo09 left a comment

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 d06871a into Samsung:main Jun 18, 2025
5 checks passed
@jinevening jinevening deleted the fq_linear_fp32_bias branch June 18, 2025 02:43
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