()
| 100 | |
| 101 | |
| 102 | def _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]))) |
no test coverage detected