<jupyter_start><jupyter_text>Write the GAN Architecture<jupyter_code>import torch.nn as nn
import torch.nn.functional as F
kernel = 2
stride = 1
class Discriminator(nn.Module):
    def __init__(self,conv_dim=2):
        super(Discriminator, self).__init__()
        self.conv1 = nn.Conv2d(conv_dim,conv_dim*2,kernel_size=kernel,stride=stride)
        self.conv2 = nn.Conv2d(conv_dim*2,conv_dim*4,kernel,stride)
        self.conv3 = nn.Conv2d(conv_dim*4,conv_dim*8,kernel,stride)
        self.conv4 = nn.Conv2d(conv_dim*8,conv_dim*16,kernel,stride)
        
    def forward(self,x):
        x = F.relu(self.conv1(x))
#         x = F.batch_norm(x)
        x = F.relu(self.conv2(x))
#         x = F.batch_norm(x)
        x = F.relu(self.conv3(x))
#         x = F.batch_norm(x)
        x = F.sigmoid(self.conv4(x))
        return x
Discriminator()
class Generator(nn.Module):
    def __init__(self,deconv_dim=2):
        super(Generator, self).__init__()
        self.deconv1 = nn.ConvTranspose2d(deconv_dim,deconv_dim*2,3,stride=2)
        self.deconv2 = nn.ConvTranspose2d(deconv_dim*2,deconv_dim*4,3,stride=2)
        self.deconv3 = nn.ConvTranspose2d(deconv_dim*4,deconv_dim*8,3,stride =2)
        self.deconv4 = nn.ConvTranspose2d(deconv_dim*8,deconv_dim,3,stride=2)
    
    def forward(self,x):
        
        x = F.relu(self.deconv1(x))
#         x = F.batch_norm(x)
        x = F.relu(self.deconv2(x))
#         x = F.batch_norm(x)
        x = F.relu(self.deconv3(x))
#         x = F.batch_norm(x)
        x = F.sigmoid(self.deconv4(x))
        
        return x
Generator()
params = {'batch_size': 10,
          'shuffle': True,
          'num_workers': 6}
max_epochs = 1
dataset = torch.utils.data.DataLoader(dataset=data,**params)
dataiter = iter(dataset)
Dinput,Ginput = dataiter.next()
print(Dinput.shape,Ginput.shape)

D = Discriminator()
G = Generator()
D(Dinput)
G(Ginput)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1429316640584246, 'fraction_numerical': 0.028169014084507043, 'mean_word_length': 3.08955223880597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '139005', 'license': 'MIT', 'n_tokens_mistral': 773, 'n_tokens_neox': 762, 'n_words': 104, 'path': 'Physics Aware GAN.ipynb', 'repo_name': 'AbinavRavi/Physics-Aware-GAN', 'size': '1917'}