code: def test_guided_attention_loss_shapes(device):
      from speechbrain.nnet.loss.guidedattn_loss import (
          GuidedAttentionLoss,
      )
  
      loss = GuidedAttentionLoss().to(device)
      input_lengths = torch.tensor([3, 2, 6], device=device)
      output_lengths = torch.tensor([4, 3, 5], device=device)
      soft_mask = loss.guided_attentions(input_lengths, output_lengths)
      assert soft_mask.shape == (3, 6, 5)
      soft_mask = loss.guided_attentions(
          input_lengths, output_lengths, max_input_len=10
      )
      assert soft_mask.shape == (3, 10, 5)
      soft_mask = loss.guided_attentions(
          input_lengths, output_lengths, max_target_len=12
      )
      assert soft_mask.shape == (3, 6, 12)
      soft_mask = loss.guided_attentions(
          input_lengths,
          output_lengths,
          max_input_len=10,
          max_target_len=12,
      )
      assert soft_mask.shape == (3, 10, 12)
  
file_path: speechbrain/tests/unittests/test_losses.py
imports: import torch
  import pytest
label_desc: Use image node_id 10 for calling a global function with example usage: test_guided_attention_loss_shapes(device) without return types