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

Method binarize_weight

examples/DoReFa-Net/svhn-digit-dorefa.py:51–58  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

49
50 # monkey-patch tf.get_variable to apply fw
51 def binarize_weight(v):
52 name = v.op.name
53 # don't binarize first and last layer
54 if not name.endswith('W') or 'conv0' in name or 'fc' in name:
55 return v
56 else:
57 logger.info("Binarizing weight {}".format(v.op.name))
58 return fw(v)
59
60 def nonlin(x):
61 if BITA == 32:

Callers

nothing calls this directly

Calls 2

fwFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected