class_docstr: Guided attention loss function module.
  
  This module calculates the guided attention loss described
  in `Efficiently Trainable Text-to-Speech System Based
  on Deep Convolutional Networks with Guided Attention`_,
  which forces the attention to be diagonal.
  
  .. _`Efficiently Trainable Text-to-Speech System
      Based on Deep Convolutional Networks with Guided Attention`:
      https://arxiv.org/abs/1710.08969
class_docstr_tok: ["Guided","attention","loss","function","module",".","This","module","calculates","the","guided","attention","loss","described","in","`","Efficiently","Trainable","Text-to-Speech","System","Based","on","Deep","Convolutional","Networks","with","Guided","Attention","`","_",",","which","forces","the","attention","to","be","diagonal",".","..","_","`","Efficiently","Trainable","Text-to-Speech","System","Based","on","Deep","Convolutional","Networks","with","Guided","Attention","`",":","https",":","\/\/arxiv.org\/abs\/1710.08969"]
docstr: Initialize guided attention loss module.
  
  Args:
      sigma (float, optional): Standard deviation to control
          how close attention to a diagonal.
      alpha (float, optional): Scaling coefficient (lambda).
      reset_always (bool, optional): Whether to always reset masks.
docstr_tok: ["Initialize","guided","attention","loss","module",".","Args",":","sigma","(","float",",","optional",")",":","Standard","deviation","to","control","how","close","attention","to","a","diagonal",".","alpha","(","float",",","optional",")",":","Scaling","coefficient","(","lambda",")",".","reset_always","(","bool",",","optional",")",":","Whether","to","always","reset","masks","."]
code: def __init__(self, sigma=0.4, alpha=1.0, reset_always=True):
      """Initialize guided attention loss module.
  
      Args:
          sigma (float, optional): Standard deviation to control
              how close attention to a diagonal.
          alpha (float, optional): Scaling coefficient (lambda).
          reset_always (bool, optional): Whether to always reset masks.
  
      """
      super(GuidedAttentionLoss, self).__init__()
      self.sigma = sigma
      self.alpha = alpha
      self.reset_always = reset_always
      self.guided_attn_masks = None
      self.masks = None
  
imports: import logging
  import numpy
  import torch
  import torch.nn.functional
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
  from espnet.nets.pytorch_backend.rnn.attentions import AttForward, AttForwardTA, AttLoc
  from espnet.nets.pytorch_backend.tacotron2.cbhg import CBHG, CBHGLoss
  from espnet.nets.pytorch_backend.tacotron2.decoder import Decoder
  from espnet.nets.pytorch_backend.tacotron2.encoder import Encoder
  from espnet.nets.tts_interface import TTSInterface
  from espnet.utils.cli_utils import strtobool
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 1 to create a new GuidedAttentionLoss object from inherited base classes: torch.nn with example: obj = GuidedAttentionLoss(sigma, alpha, reset_always)