Skip to content

initialize generated_value_names with graph input#8085

Merged
yufenglee merged 2 commits into
masterfrom
yufeng/quant_fix
Jun 22, 2021
Merged

initialize generated_value_names with graph input#8085
yufenglee merged 2 commits into
masterfrom
yufeng/quant_fix

Conversation

@yufenglee

Copy link
Copy Markdown
Member

generated_value_names should be initialized with graph input, or it will add a dequantize for input, which is used by another op.

@yufenglee yufenglee requested a review from zhanghuanrong June 17, 2021 16:52
@yufenglee yufenglee requested a review from a team as a code owner June 17, 2021 16:52
# some output from nodes will be quantized, yet itself should be treat as existing so
# no dequantized will be applied when needed later
self.generated_value_names = {}
self.generated_value_names = self.model.get_non_initializer_inputs()

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.

Nice concept, could we also add both initializer and input here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We have a logic to remove quantized initializer below. If the initializer is used by both quantized op and fp32 op, there will be no logic to dequantize the quantized initializer back.


def get_non_initializer_inputs(self):
initializer_names = self.get_initializer_name_set()
non_initializer_inputs = set()

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.

If set is used, later usage for generated_value_names better also change to set() semantic

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

get_non_initializer_inputs returns set type and the generated_value_names is assigned with the set

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.

I mean later code is using it as map

@yufenglee yufenglee merged commit 4bb0e29 into master Jun 22, 2021
@yufenglee yufenglee deleted the yufeng/quant_fix branch June 22, 2021 22:08
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