class_docstr: Differential Spectral Loss
  https://arxiv.org/ftp/arxiv/papers/1909/1909.10302.pdf
docstr:  Shapes:
      x: B x T
      target: B x T
      length: B
  Returns:
      loss: An average loss value in range [0, 1] masked by the length.
docstr_tok: ["Shapes",":","x",":","B","x","T","target",":","B","x","T","length",":","B","Returns",":","loss",":","An","average","loss","value","in","range","[","0",",","1","]","masked","by","the","length","."]
code: def forward(self, x, target, length=None):
      """
       Shapes:
          x: B x T
          target: B x T
          length: B
      Returns:
          loss: An average loss value in range [0, 1] masked by the length.
      """
      x_diff = x[:, 1:] - x[:, :-1]
      target_diff = target[:, 1:] - target[:, :-1]
      if length is None:
          return self.loss_func(x_diff, target_diff)
      return self.loss_func(x_diff, target_diff, length - 1)
  
imports: import math
  import numpy
  import torch
  from torch import nn
  from inspect import signature
  from torch.nn import functional
  from TTS.tts.utils.generic_utils import sequence_mask
  from TTS.tts.utils.ssim import ssim
label_desc: Use image node_id 2 for calling the DifferentailSpectralLoss obj's underlying member method code with example usage: obj.forward(x, target, length) and returns: self, self