code: def _loss(
      self,
      inputs: Dict[str, tf.Tensor],
      targets: Dict[str, tf.Tensor],
      outputs: Dict[str, tf.Tensor],
  ) -> Dict[str, tf.Tensor]:
      def to_2d_list(x):
          return K.expand_dims(K.flatten(x), axis=-1)
  
      # note: blank is last index
      return {
          "ctc-loss": K.ctc_batch_cost(
              targets["gt"] - 1,
              outputs["blank_last_softmax"],
              to_2d_list(outputs["out_len"]),
              to_2d_list(targets["gt_len"]),
          )
      }
  
file_path: calamari/calamari_ocr/ocr/model/model.py
imports: from typing import Dict, List, Tuple
  import Levenshtein
  import bidi.algorithm
  import tensorflow
  from tensorflow.python.ops import math_ops
  from tfaip import Sample
  from tfaip.model.modelbase import ModelBase
  from calamari_ocr.ocr.model.params import ModelParams
label_desc: Use image node_id 3 for calling the Model obj's underlying member method code with example usage: obj._loss(inputs, targets, outputs) and returns: dict, K