Returns True if the tensor is followed by a FakeQuant.
(tensor)
| 644 | |
| 645 | |
| 646 | def _FollowedByFakeQuant(tensor): |
| 647 | """Returns True if the tensor is followed by a FakeQuant.""" |
| 648 | fake_quant_ops = set([ |
| 649 | 'FakeQuantWithMinMaxVars', 'FakeQuantWithMinMaxArgs', |
| 650 | 'FakeQuantWithMinMaxVarsPerChannel' |
| 651 | ]) |
| 652 | pass_through_ops = set(['Reshape', 'Identity']) |
| 653 | consumers = tensor.consumers() |
| 654 | while consumers: |
| 655 | c = consumers.pop() |
| 656 | if c.type in fake_quant_ops: |
| 657 | return True |
| 658 | elif c.type in pass_through_ops: |
| 659 | for output in c.outputs: |
| 660 | consumers.extend(output.consumers()) |
| 661 | return False |
| 662 | |
| 663 | |
| 664 | def _InsertQuantOp(context, |
no test coverage detected