Hey I think I have the same issue. where self.D is probably a discriminator net that looks something like:
class DiscriminatorNet(torch.nn.Module):
    """
    A discriminative neural network
    """
    def __init__(self):
        super(DiscriminatorNet, self).__init__()
        n_out = 1
        
        self.hidden0 = nn.Sequential( 
            nn.Conv1d(in_channels=4,out_channels=100,kernel_size=1)
        )
        
        self.hidden1 = nn.Sequential(
            ResBlock(DIM),
            ResBlock(DIM),
            ResBlock(DIM),
            ResBlock(DIM),
            ResBlock(DIM)
        )
          
        self.out = nn.Sequential(
            nn.Linear(DIM * L, n_out),
        )

    def forward(self, x):
        # transpose x to match size of layers
        x = x.permute(0,2,1)
        x = self.hidden0(x)
        x = self.hidden1(x)
        x = x.view(-1, DIM * L)
        x = self.out(x)
        return x

And the error occurs at the line gradient_penalty.backward()