class_docstr: Base class for graph transducer losses.
  Implementation of the approach described in "Powerful and Extensible WFST Framework for RNN-Transducer Losses"
  https://ieeexplore.ieee.org/document/10096679
  
  Compose-Transducer: compose the unit (target text) and temporal schemas (graphs) into lattice.
      Subclass should implement `get_unit_schema` and `get_temporal_schema` methods.
  Grid-Transducer: construct the RNN-T lattice (grid) directly in code.
      Subclass should implement `get_grid` method.
docstr: Args:
      use_grid_implementation: Whether to use the grid implementation (Grid-Transducer).
      connect_composed: Connect graph after composing unit and temporal schemas (only for Compose-Transducer).
          `connect` operation is slow, it is useful for visualization, but not necessary for loss computation.
      double_scores: Use calculation of loss in double precision (float64) in the lattice.
          Does not significantly affect memory usage since the lattice is ~V/2 times smaller
          than the joint tensor.
      cast_to_float32: Force cast joint tensor to float32 before log-softmax calculation.
docstr_tok: ["Args",":","use_grid_implementation",":","Whether","to","use","the","grid","implementation","(","Grid-Transducer",")",".","connect_composed",":","Connect","graph","after","composing","unit","and","temporal","schemas","(","only","for","Compose-Transducer",")",".","`","connect","`","operation","is","slow",",","it","is","useful","for","visualization",",","but","not","necessary","for","loss","computation",".","double_scores",":","Use","calculation","of","loss","in","double","precision","(","float64",")","in","the","lattice",".","Does","not","significantly","affect","memory","usage","since","the","lattice","is","~V\/2","times","smaller","than","the","joint","tensor",".","cast_to_float32",":","Force","cast","joint","tensor","to","float32","before","log-softmax","calculation","."]
code: def __init__(
      self,
      use_grid_implementation: bool,
      connect_composed=False,
      double_scores=False,
      cast_to_float32=False,
  ):
      """
  
      Args:
          use_grid_implementation: Whether to use the grid implementation (Grid-Transducer).
          connect_composed: Connect graph after composing unit and temporal schemas (only for Compose-Transducer).
              `connect` operation is slow, it is useful for visualization, but not necessary for loss computation.
          double_scores: Use calculation of loss in double precision (float64) in the lattice.
              Does not significantly affect memory usage since the lattice is ~V/2 times smaller
              than the joint tensor.
          cast_to_float32: Force cast joint tensor to float32 before log-softmax calculation.
      """
      super().__init__()
      self.use_grid_implementation = use_grid_implementation
      self.connect_composed = connect_composed
      self.double_scores = double_scores
      self.cast_to_float32 = cast_to_float32
  
imports: import abc
  from contextlib import nullcontext
  from typing import ContextManager
  import torch
  import torch.nn.functional
  from nemo.core.classes.loss import Loss
  from nemo.core.utils.k2_guard import k2
label_desc: Use image node_id 1 to create a new GraphTransducerLossBase object from inherited base classes: Loss with example: obj = GraphTransducerLossBase(use_grid_implementation, connect_composed, double_scores, cast_to_float32)