class_docstr: Adds utilities for computing interCTC loss from https://arxiv.org/abs/2102.03216.
  
  To use, make sure encoder accesses ``interctc['capture_layers']``
  property in the AccessMixin and registers ``interctc/layer_output_X`` and
  ``interctc/layer_length_X`` for all layers that we want to get loss from.
  Additionally, specify the following config parameters to set up loss::
  
      interctc:
          # can use different values
          loss_weights: [0.3]
          apply_at_layers: [8]
  
  Then call
  
      * ``self.setup_interctc(ctc_decoder_name, ctc_loss_name, ctc_wer_name)``
        in the init method
      * ``self.add_interctc_losses`` after computing regular loss.
      * ``self.finalize_interctc_metrics(metrics, outputs, prefix="val_")``
        in the `multi_validation_epoch_end` method.
      * ``self.finalize_interctc_metrics(metrics, outputs, prefix="test_")``
        in the `multi_test_epoch_end` method.
class_docstr_tok: ["Adds","utilities","for","computing","interCTC","loss","from","https",":","\/\/arxiv.org\/abs\/2102.03216",".","To","use",",","make","sure","encoder","accesses","``","interctc","[","'capture_layers","'","]","``","property","in","the","AccessMixin","and","registers","``","interctc\/layer_output_X","``","and","``","interctc\/layer_length_X","``","for","all","layers","that","we","want","to","get","loss","from",".","Additionally",",","specify","the","following","config","parameters","to","set","up","loss",":",":","interctc",":","#","can","use","different","values","loss_weights",":","[","0.3","]","apply_at_layers",":","[","8","]","Then","call","*","``","self.setup_interctc","(","ctc_decoder_name",",","ctc_loss_name",",","ctc_wer_name",")","``","in","the","init","method","*","``","self.add_interctc_losses","``","after","computing","regular","loss",".","*","``","self.finalize_interctc_metrics","(","metrics",",","outputs",",","prefix=","''","val_","''",")","``","in","the","`","multi_validation_epoch_end","`","method",".","*","``","self.finalize_interctc_metrics","(","metrics",",","outputs",",","prefix=","''","test_","''",")","``","in","the","`","multi_test_epoch_end","`","method","."]
docstr: Sets up all interctc-specific parameters and checks config consistency.
  
  Caller has to specify names of attributes to perform CTC-specific WER,
  decoder and loss computation. They will be looked up in the class
  state with ``getattr``.
  
  The reason we get the names and look up object later is because those
  objects might change without re-calling the setup of this class. So
  we always want to look up the most up-to-date object instead of
  "caching" it here.
docstr_tok: ["Sets","up","all","interctc-specific","parameters","and","checks","config","consistency",".","Caller","has","to","specify","names","of","attributes","to","perform","CTC-specific","WER",",","decoder","and","loss","computation",".","They","will","be","looked","up","in","the","class","state","with","``","getattr","``",".","The","reason","we","get","the","names","and","look","up","object","later","is","because","those","objects","might","change","without","re-calling","the","setup","of","this","class",".","So","we","always","want","to","look","up","the","most","up-to-date","object","instead","of","''","caching","''","it","here","."]
code: def setup_interctc(self, decoder_name, loss_name, wer_name):
      """Sets up all interctc-specific parameters and checks config consistency.
  
      Caller has to specify names of attributes to perform CTC-specific WER,
      decoder and loss computation. They will be looked up in the class
      state with ``getattr``.
  
      The reason we get the names and look up object later is because those
      objects might change without re-calling the setup of this class. So
      we always want to look up the most up-to-date object instead of
      "caching" it here.
      """
      # registering all parameters in a dictionary to avoid conflicts with
      # main class's names
      self._interctc_params = {}
      interctc_config = self.cfg.get("interctc")
      if interctc_config is not None:
          # if interctc is in the config, we want to check that it indeed defines
          # the required keys and nothing else - that's automatically done by
          # matching with keyword arguments in self._process_config_values
          self._process_config_values(**interctc_config)
          self._interctc_params["decoder_name"] = decoder_name
          self._interctc_params["loss_name"] = loss_name
          self._interctc_params["wer_name"] = wer_name
      else:
          self.set_interctc_param("enabled", False)
  
file_path: NeMo/nemo/collections/asr/parts/mixins/interctc_mixin.py
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from nemo.core.classes.mixins import AccessMixin
label_desc: Use image node_id 2 for calling the InterCTCMixin obj's underlying member method code with example usage: obj.setup_interctc(decoder_name, loss_name, wer_name) without return types