class_docstr: Efficiently Trainable Text-to-Speech System Based on Deep Convolutional
  Networks with Guided Attention (https://arxiv.org/abs/1710.08969)
class_docstr_tok: ["Efficiently","Trainable","Text-to-Speech","System","Based","on","Deep","Convolutional","Networks","with","Guided","Attention","(","https",":","\/\/arxiv.org\/abs\/1710.08969",")"]
code: def _get_weight(s_len, t_len, sigma):
      grid_x, grid_y = torch.meshgrid(
          torch.arange(t_len), torch.arange(s_len)
      )
      grid_x = grid_x.to(s_len.device)
      grid_y = grid_y.to(s_len.device)
      w = (grid_y.float() / s_len - grid_x.float() / t_len) ** 2
      return 1.0 - torch.exp(-w / (2 * (sigma**2)))
  
imports: import logging
  from dataclasses import dataclass, field
  from functools import lru_cache
  from typing import Any, Dict, List
  import torch
  import torch.nn.functional
  from omegaconf import II
  from fairseq import utils
  from fairseq.logging import metrics
  from fairseq.criterions import FairseqCriterion, register_criterion
  from fairseq.data.data_utils import lengths_to_mask
  from fairseq.dataclass import FairseqDataclass
label_desc: Use image node_id 2 for calling the GuidedAttentionLoss obj's underlying member method code with example usage: obj._get_weight(s_len, t_len, sigma) and returns: unknown