class_docstr: Mixin class for applying the R3F method, to apply R3F with any model
  inherit the class and implement the abstract functions.
  
  For more details: https://arxiv.org/abs/2008.03156
class_docstr_tok: ["Mixin","class","for","applying","the","R3F","method",",","to","apply","R3F","with","any","model","inherit","the","class","and","implement","the","abstract","functions",".","For","more","details",":","https",":","\/\/arxiv.org\/abs\/2008.03156"]
docstr: Computes the auxillary loss for R3F, in particular computes a symmetric
  KL divergence between the result from the input embedding and the noise
  input embedding.
docstr_tok: ["Computes","the","auxillary","loss","for","R3F",",","in","particular","computes","a","symmetric","KL","divergence","between","the","result","from","the","input","embedding","and","the","noise","input","embedding","."]
code: def get_r3f_loss_terms(
      self, model_outputs, noise_model_outputs, sample_size: int
  ) -> torch.Tensor:
      """
      Computes the auxillary loss for R3F, in particular computes a symmetric
      KL divergence between the result from the input embedding and the noise
      input embedding.
      """
  
      label_symm_kl = compute_symmetric_kl(
          self.get_r3f_model_output(noise_model_outputs),
          self.get_r3f_model_output(model_outputs),
      )
  
      label_symm_kl = label_symm_kl  # * sample_size
  
      return (
          self.r3f_lambda_by_loss.get("label", self.r3f_default_lambda)
          * label_symm_kl
      )
  
imports: from contextlib import AbstractContextManager
  from enum import Enum
  from typing import Dict
  import torch
  import torch.nn.functional
  from pytext.common.constants import Stage
  from pytext.config import ConfigBase
  from pytext.utils.precision import maybe_float
label_desc: Use image node_id 8 for calling the R3FPyTextMixin obj's underlying member method code with example usage: obj.get_r3f_loss_terms(model_outputs, noise_model_outputs, sample_size) and returns: unknown