code: def _on_batch_end(original_fn, recorder, *args, **kwargs):
      original_fn(recorder, *args, **kwargs)
      if not PatchFastaiV1._current_task:
          return
  
      # noinspection PyBroadException
      try:
          iteration = kwargs.get("iteration", 0)
          if iteration == 0 or not kwargs.get("train"):
              return
  
          logger = PatchFastaiV1._current_task.get_logger()
          logger.report_scalar(
              title="metrics",
              series="train_loss",
              value=kwargs.get("last_loss", 0),
              iteration=iteration,
          )
          params = [
              (name, values.clone().detach().cpu())
              for (name, values) in recorder.model.named_parameters()
          ]
          if (
              id(recorder) not in PatchFastaiV1.__gradient_hist_helpers
              or PatchFastaiV1.__gradient_hist_helpers[
                  id(recorder)
              ].logger
              is not logger
          ):
              PatchFastaiV1.__gradient_hist_helpers[
                  id(recorder)
              ] = WeightsGradientHistHelper(logger)
          histograms = []
          for name, values in params:
              histograms.append(
                  dict(
                      title="model_weights",
                      series="model_weights/" + name,
                      step=iteration,
                      hist_data=values,
                  )
              )
          PatchFastaiV1.__gradient_hist_helpers[
              id(recorder)
          ].add_histograms(histograms)
      except Exception:
          pass
  
imports: import sys
  import numpy
  from clearml.utilities.version import Version
  from .None import _patched_call
  from .tensorflow_bind import WeightsGradientHistHelper
  from ..import_bind import PostImportHookPatching
  from ...debugging.log import LoggerRoot
  from .tensorflow_bind import IsTensorboardInit
label_desc: Use image node_id 6 for calling the PatchFastaiV1 obj's underlying member method code with example usage: obj._on_batch_end(original_fn, recorder) without return types