thanks for reply @Dwight_Foster ! Ofcourse…
generator = Generator()
discriminator = Discriminator()
loss_discriminator=nn.BCELoss()
discriminator_optimizer = torch.optim.Adam(discriminator.parameters(), lr=0.0002, betas=(0.5,0.999))
generator_optimizer = torch.optim.Adam(generator.parameters(), lr=0.0002, betas=(0.5,0.999))
for iteration,(x,r) in enumerate(Train_Loader):
        X_real,y_real=generate_real_samples(x.to(device))
        # 1. Train D on Real+Fake data
        discriminator.train()
        generator.eval()
        X_fake=generator(r.to(device))
        discriminator_optimizer.zero_grad()
        # 1.A Train D on Real data
        out_diss=discriminator(X_real)
        d_loss1=loss_discriminator(out_diss,y_real)
        d_loss1.backward()
        discriminator_optimizer.step()
        # 1.B Train D on Fake data
        d_loss2=loss_discriminator(discriminator(torch.cat([x.to(device),X_fake], dim=1)),torch.zeros(x.shape).to(device))
        d_loss2.backward()
        discriminator_optimizer.step()
        # 2. Train D on Real+Fake data
        #generator_optimizer.zero_grad()
        #discriminator.eval()
        #generator.train()
        #X_fake=generator(r.to(device))
        #loss_g=gen_loss(x.to(device),X_fake,discriminator(torch.cat([x.to(device),X_fake], dim=1)))
        #loss_g.backward()
        #generator_optimizer.step()