class_docstr: This class jointly handles the hidden transforms and hidden loss transforms.
  It helps in validating, and applying the transforms.
class_docstr_tok: ["This","class","jointly","handles","the","hidden","transforms","and","hidden","loss","transforms",".","It","helps","in","validating",",","and","applying","the","transforms","."]
docstr: Apply hidden transforms
  Args:
      inputs: a dictionary of inputs, with "hiddens" as the default key for hidden states
      batch_data: a dictionary of batch data (e.g. "input_features"), optional
  
  Returns:
      outputs: a dictionary of outputs, collecting 
docstr_tok: ["Apply","hidden","transforms","Args",":","inputs",":","a","dictionary","of","inputs",",","with","``","hiddens","''","as","the","default","key","for","hidden","states","batch_data",":","a","dictionary","of","batch","data","(","e.g",".","``","input_features","''",")",",","optional","Returns",":","outputs",":","a","dictionary","of","outputs",",","collecting"]
code: def apply_hidden_transforms(self, inputs, batch_data=None):
      """
      Apply hidden transforms
      Args:
          inputs: a dictionary of inputs, with "hiddens" as the default key for hidden states
          batch_data: a dictionary of batch data (e.g. "input_features"), optional
  
      Returns:
          outputs: a dictionary of outputs, collecting
      """
      outputs = inputs.copy()
      for hidden_transform in self.hidden_transforms:
          # make sure to collect all outputs from hidden transforms
          outputs.update(
              hidden_transform.transform(outputs, batch_data=batch_data)
          )
  
      # update final encoder output
      outputs["enc_output"] = outputs[self.enc_output_name]
  
      return outputs
  
imports: import functools
  import itertools
  from typing import List
  import torch
  from omegaconf.dictconfig import DictConfig
  from omegaconf.omegaconf import OmegaConf
  from nemo.collections.nlp.modules.common.megatron.hiddens.megatron_hidden_loss import MegatronBaseHiddenLoss
  from nemo.collections.nlp.modules.common.megatron.hiddens.megatron_hidden_transform import MegatronBaseHiddenTransform
  from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults
  from nemo.utils import logging
  from nemo.utils.model_utils import import_class_by_path
label_desc: Use image node_id 4 for calling the MegatronHiddensModule obj's underlying member method code with example usage: obj.apply_hidden_transforms(inputs, batch_data) and returns: outputs