class_docstr: Abstract base class for RLlib callbacks (similar to Keras callbacks).
  
  These callbacks can be used for custom metrics and custom postprocessing.
  
  By default, all of these callbacks are no-ops. To configure custom training
  callbacks, subclass DefaultCallbacks and then set
  {"callbacks": YourCallbacksClass} in the algo config.
class_docstr_tok: ["Abstract","base","class","for","RLlib","callbacks","(","similar","to","Keras","callbacks",")",".","These","callbacks","can","be","used","for","custom","metrics","and","custom","postprocessing",".","By","default",",","all","of","these","callbacks","are","no-ops",".","To","configure","custom","training","callbacks",",","subclass","DefaultCallbacks","and","then","set","{","``","callbacks","''",":","YourCallbacksClass","}","in","the","algo","config","."]
docstr: Called at the beginning of Policy.learn_on_batch().
  
  Note: This is called before 0-padding via
  `pad_batch_to_sequences_of_same_size`.
  
  Also note, SampleBatch.INFOS column will not be available on
  train_batch within this callback if framework is tf1, due to
  the fact that tf1 static graph would mistake it as part of the
  input dict if present.
  It is available though, for tf2 and torch frameworks.
  
  Args:
      policy: Reference to the current Policy object.
      train_batch: SampleBatch to be trained on. You can
          mutate this object to modify the samples generated.
      result: A results dict to add custom metrics to.
      kwargs: Forward compatibility placeholder.
docstr_tok: ["Called","at","the","beginning","of","Policy.learn_on_batch","(",")",".","Note",":","This","is","called","before","0-padding","via","`","pad_batch_to_sequences_of_same_size","`",".","Also","note",",","SampleBatch.INFOS","column","will","not","be","available","on","train_batch","within","this","callback","if","framework","is","tf1",",","due","to","the","fact","that","tf1","static","graph","would","mistake","it","as","part","of","the","input","dict","if","present",".","It","is","available","though",",","for","tf2","and","torch","frameworks",".","Args",":","policy",":","Reference","to","the","current","Policy","object",".","train_batch",":","SampleBatch","to","be","trained","on",".","You","can","mutate","this","object","to","modify","the","samples","generated",".","result",":","A","results","dict","to","add","custom","metrics","to",".","kwargs",":","Forward","compatibility","placeholder","."]
code: def on_learn_on_batch(
      self,
      *,
      policy: Policy,
      train_batch: SampleBatch,
      result: dict,
      **kwargs,
  ) -> None:
      """Called at the beginning of Policy.learn_on_batch().
  
      Note: This is called before 0-padding via
      `pad_batch_to_sequences_of_same_size`.
  
      Also note, SampleBatch.INFOS column will not be available on
      train_batch within this callback if framework is tf1, due to
      the fact that tf1 static graph would mistake it as part of the
      input dict if present.
      It is available though, for tf2 and torch frameworks.
  
      Args:
          policy: Reference to the current Policy object.
          train_batch: SampleBatch to be trained on. You can
              mutate this object to modify the samples generated.
          result: A results dict to add custom metrics to.
          kwargs: Forward compatibility placeholder.
      """
      pass
  
imports: import gc
  import os
  import platform
  import tracemalloc
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Type, Union
  import gymnasium
  import numpy
  from ray.rllib.core.rl_module.rl_module import RLModule
  from ray.rllib.env.base_env import BaseEnv
  from ray.rllib.env.env_context import EnvContext
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.evaluation.episode_v2 import EpisodeV2
  from ray.rllib.evaluation.postprocessing import Postprocessing
  from ray.rllib.policy import Policy
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.annotations import override, OverrideToImplementCustomLogic, PublicAPI
  from ray.rllib.utils.deprecation import deprecation_warning
  from ray.rllib.utils.exploration.random_encoder import _MovingMeanStd, compute_states_entropy, update_beta
  from ray.rllib.utils.typing import AgentID, EnvType, EpisodeType, PolicyID
  from ray.tune.callback import _CallbackMeta
  import psutil
label_desc: Use image node_id 16 for calling the DefaultCallbacks obj's underlying member method code with example usage: obj.on_learn_on_batch() without return types