The new point I found is below:
I changed the line order,
pg=self.model['D'](images)
po=self.model['D'](outputs.detach())

then the loss1 works.But now loss2 can’t backward.
Seems the two are confilcts
Here is my Dis network code:
class Discriminator(nn.Module):
    def __init__(self,in_dim=3,inner_dim=64,norm=True):
        super(Discriminator, self).__init__()
        def getSpectralNormedModule(module,norm):
            if norm:
                 return nn.utils.spectral_norm(module)
            return module
        self.conv1=nn.Sequential(
            getSpectralNormedModule(nn.Conv2d(in_dim,inner_dim,4,2,1),norm),
            nn.BatchNorm2d(inner_dim),
            nn.LeakyReLU(0.2)
        )
        self.conv2=nn.Sequential(
            getSpectralNormedModule(nn.Conv2d(inner_dim,2*inner_dim,4,2,1),norm),
            nn.BatchNorm2d(2*inner_dim),
            nn.LeakyReLU(0.2)
        )
        self.conv3=nn.Sequential(
            getSpectralNormedModule(nn.Conv2d(2*inner_dim,4*inner_dim,4,2,1),norm),
            nn.BatchNorm2d(4*inner_dim),
            nn.LeakyReLU(0.2)
        )
        self.conv4=nn.Sequential(
            getSpectralNormedModule(nn.Conv2d(4 * inner_dim, 4 * inner_dim, 4, 1, 1), norm),
            nn.BatchNorm2d(4 * inner_dim),
            nn.LeakyReLU(0.2)
        )
        self.conv5 = nn.Sequential(
            getSpectralNormedModule(nn.Conv2d(4 * inner_dim, 4 * inner_dim, 4, 1, 1), norm),
            nn.BatchNorm2d(4 * inner_dim),
            nn.LeakyReLU(0.2)
        )
    def forward(self,x):
        x1=self.conv1(x)
        x2=self.conv2(x1)
        x3=self.conv3(x2)
        x4=self.conv4(x3)
        x5=self.conv5(x4)
        return x5

I still can’t figure out the key point.Someone Plz help me.I’m new to GAN.