MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / _check_unused_regularization

Function _check_unused_regularization

tensorpack/train/interface.py:102–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100
101
102def _check_unused_regularization():
103 coll = tfv1.get_collection(tfv1.GraphKeys.REGULARIZATION_LOSSES)
104 unconsumed_reg = []
105 for c in coll:
106 if len(c.consumers()) == 0:
107 unconsumed_reg.append(c)
108 if unconsumed_reg:
109 logger.warn("The following tensors appear in REGULARIZATION_LOSSES collection but have no "
110 "consumers! You may have forgotten to add regularization to total cost.")
111 logger.warn("Unconsumed regularization: {}".format(', '.join([x.name for x in unconsumed_reg])))

Callers 1

launch_train_with_configFunction · 0.85

Calls 4

get_collectionMethod · 0.80
appendMethod · 0.80
formatMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected