code: def _check_unused_regularization():
      coll = tfv1.get_collection(tfv1.GraphKeys.REGULARIZATION_LOSSES)
      unconsumed_reg = []
      for c in coll:
          if len(c.consumers()) == 0:
              unconsumed_reg.append(c)
      if unconsumed_reg:
          logger.warn(
              "The following tensors appear in REGULARIZATION_LOSSES collection but have no "
              "consumers! You may have forgotten to add regularization to total cost."
          )
          logger.warn(
              "Unconsumed regularization: {}".format(
                  ", ".join([x.name for x in unconsumed_reg])
              )
          )
  
file_path: tensorpack/tensorpack/train/interface.py
imports: from ..compat import tfv1
  from ..input_source import FeedInput, InputSource, QueueInput, StagingInput
  from ..utils import logger
  from ..compat import is_tfv2
  from .config import TrainConfig
  from .tower import SingleCostTrainer
  from .trainers import SimpleTrainer
label_desc: Use image node_id 3 for calling a global function with example usage: _check_unused_regularization() without return types