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","."]
code: def _process_config_values(
      self, loss_weights: List[float], apply_at_layers: List[int]
  ):
      self.set_interctc_param("intermediate_loss_weights", loss_weights)
      self.set_interctc_param("apply_at_layers", apply_at_layers)
      self.set_interctc_param(
          "main_loss_weight", 1.0 - sum(loss_weights)
      )
      if self.get_interctc_param("main_loss_weight") <= 0.0:
          raise ValueError(
              "Make sure that sum of intermediate loss weights is < 1.0. "
              "Note that we don't do any normalization and assign "
              "remaining weight to the regular model loss. "
              "E.g., if interctc.loss_weights = [0.1, 0.3], regular "
              "loss will have weight of 0.6"
          )
      self.set_interctc_param("enabled", len(loss_weights) > 0)
  
      if len(apply_at_layers) != len(loss_weights):
          raise ValueError(
              "Length of interctc.apply_at_layers has to match interctc.loss_weights"
          )
  
      # setting up config for AccessMixin that will be checked in encoders to
      # log the layers we need
      AccessMixin.update_access_cfg(
          {"interctc": {"capture_layers": apply_at_layers}}
      )
  
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 1 for calling the InterCTCMixin obj's underlying member method code with example usage: obj._process_config_values(loss_weights, apply_at_layers) without return types