Question: Artificial Intelligence - Python constructing two networks here. Trying to do this by crafting custom Modules (in PyTorch) Just need two things in Module: `__init__`
Artificial Intelligence - Python
constructing two networks here. Trying to do this by crafting custom Modules (in PyTorch) Just need two things in Module:
`__init__` - constructor
`forward` - what the module does in the forward pass
CODE:
class EncoderCNN(nn.Module): def __init__(self,channels,embedding_size): super(EncoderCNN, self).__init__() #TODO set up you Encoder CNN self.channels = None #Input channels = 3 self.conv1 = None self.bn1 = None self.pool1 =None self.conv2 = None self.bn2 = None self.pool2 = None self.conv3 = None self.bn3 = None self.pool3 = None self.embed = None def forward(self, x): #TODO apply the 3 convolutional layers (convolution, batch norm, relu, pool) #TODO reshape the data #TODO embed the output and apply a ReLU activation return x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
