code: def _to_tensorboard(
      name="Image", log_dir="./logs", comment="torchbearer"
  ):
      import torchbearer.callbacks.tensor_board as tb
      import os
  
      log_dir = os.path.join(log_dir, comment)
  
      def handler(image, index, state):
          writer = tb.get_writer(log_dir, _to_tensorboard)
          writer.add_image(
              name.format(index=str(index)),
              image.clamp(0, 1),
              state[torchbearer.EPOCH],
          )
          tb.close_writer(log_dir, _to_tensorboard)
  
      return handler
  
imports: import torchbearer
  from torchbearer import Callback
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: _to_tensorboard(name, log_dir, comment) and returns: handler