Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

update checking logic for scale and zp op #83

Merged
merged 3 commits into from
Jul 16, 2024

Conversation

zezhang
Copy link
Contributor

@zezhang zezhang commented Jul 16, 2024

For fake_quantize_ops, scale and zero_point operands could be lowered by TorchToTcp already, so we need to relax the checking condition here (just need to make sure the type and shape are valid).

Copy link
Collaborator

@sjain-stanford sjain-stanford left a comment

Choose a reason for hiding this comment

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

LGTM with a comment request.

op, "Scale operation is not ValueTensorLiteralOp");
auto scaleElements =
dyn_cast<DenseFPElementsAttr>(scaleTensor.getValueAttr());
// scale should be a [1] tensor.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's keep this comment, since it's not immediately apparent (to me) when reading scaleTy.getShape().size() == 1 && scaleTy.getNumElements() == 1.

op, "Scale operation is not ValueTensorLiteralOp");
auto scaleElements =
dyn_cast<DenseFPElementsAttr>(scaleTensor.getValueAttr());
// scale should be a [C] tensor.
Copy link
Collaborator

Choose a reason for hiding this comment

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

same

@zezhang zezhang merged commit 05798b6 into cruise-automation:main Jul 16, 2024
1 check passed
@zezhang zezhang deleted the zezhang/fake_quantize_update branch July 16, 2024 20:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants