MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _FollowedByFakeQuant

Function _FollowedByFakeQuant

tensorflow/contrib/quantize/python/quantize.py:646–661  ·  view source on GitHub ↗

Returns True if the tensor is followed by a FakeQuant.

(tensor)

Source from the content-addressed store, hash-verified

644
645
646def _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
664def _InsertQuantOp(context,

Callers 1

_InsertQuantOpFunction · 0.85

Calls 3

consumersMethod · 0.45
popMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected