MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / new_get_variable

Method new_get_variable

examples/DoReFa-Net/alexnet-dorefa.py:74–81  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

72
73 # monkey-patch tf.get_variable to apply fw
74 def new_get_variable(v):
75 name = v.op.name
76 # don't binarize first and last layer
77 if not name.endswith('W') or 'conv0' in name or 'fct' in name:
78 return v
79 else:
80 logger.info("Quantizing weight {}".format(v.op.name))
81 return fw(v)
82
83 def nonlin(x):
84 if BITA == 32:

Callers

nothing calls this directly

Calls 2

fwFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected