code: def _to_visdom(
      name="Image",
      log_dir="./logs",
      comment="torchbearer",
      visdom_params=None,
  ):
      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_visdom,
              visdom=True,
              visdom_params=visdom_params,
          )
          writer.add_image(
              name.format(index=str(index))
              + "_"
              + str(state[torchbearer.EPOCH]),
              image.clamp(0, 1),
              state[torchbearer.EPOCH],
          )
          tb.close_writer(log_dir, _to_visdom)
  
      return handler
  
imports: import torchbearer
  from torchbearer import Callback
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: _to_visdom(name, log_dir, comment, visdom_params) and returns: handler