code: def test_masked_loss_l2(self):
      loss_fn = MaskedMSELoss()
      target = torch.tensor(
          [[[1.0], [2.0], [4.0]], [[3.0], [0.0], [0.0]]]
      ).transpose(1, 2)
      predicted = torch.tensor(
          [[[0.5], [1.0], [4.0]], [[4.5], [0.0], [0.0]]]
      ).transpose(1, 2)
      target_len = torch.tensor([3, 1])
  
      loss = loss_fn(
          predicted=predicted, target=target, target_len=target_len
      )
  
      assert loss == (4 / 3)
  
file_path: NeMo/tests/collections/tts/losses/test_audio_codec_loss.py
imports: import pytest
  import torch
  from torchmetrics import ScaleInvariantSignalDistortionRatio
  from nemo.collections.tts.losses.audio_codec_loss import MaskedMAELoss, MaskedMSELoss, SISDRLoss
  from nemo.collections.tts.parts.utils.helpers import mask_sequence_tensor
label_desc: Use image node_id 2 for calling the TestAudioCodecLoss obj's underlying member method code with example usage: obj.test_masked_loss_l2() without return types