SIGN IN SIGN UP

Add pass to properly check if q and dq nodes are implicit (#49)

Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/49

This diff adds a pass which is used to tag "implicit" q/dq nodes, which should be ignored during preprocessing.

A q or dq node is deemed to be "implicit" if any of the following hold:

a) All of its inputs are constants (get_attr nodes), since (de)quantizing constants is done outside of executing the graph

b) It is the q or dq surrounding a "supported" group of nodes, ordered as dq -> [supported group] -> q. A "supported" group is comprised of one of the following: (i) A single supported op, from SUPPORTED_QUANT_OPS_SET, (ii) A single supported module, from SUPPORTED_QUANT_MODULES_SET, or (iii) a chain of nodes matching a supported chain from SUPPORTED_QUANT_CHAINS. q/dq nodes which match this condition should be ignore during preprocessing because they are only used as signaling for q params of node inputs

c) It is a dq followed by aten.linear.default and then an output node. This is because aten.linear.default is a special op corresponding with dqlinear which doesn't necessarily have an q after it

Reviewed By: digantdesai, mcr229

Differential Revision: D47900500

fbshipit-source-id: d277a6db3f819f3382155797620a160693037bc0
S
Salil Desai committed
0b317e5733919c904ea70df76a10d606b7c71e51
Parent: 67b74cf
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 8/11/2023, 6:43:33 PM