DemoEmotions / utils /ImageOnly.py
karpurna2's picture
initial upload
127e34a
raw
history blame
859 Bytes
import torch.nn as nn
class Decoder4(nn.Module):
def __init__(self, input_dim, output_dim):
super(Decoder4, self).__init__()
self.fc1 = nn.Linear(input_dim, 256)
self.batch_norm1 = nn.BatchNorm1d(256)
self.relu1 = nn.ReLU()
self.dropout1 = nn.Dropout(0.5)
self.fc2 = nn.Linear(256, 128)
self.batch_norm2 = nn.BatchNorm1d(128)
self.relu2 = nn.ReLU()
self.dropout2 = nn.Dropout(0.5)
self.fc3 = nn.Linear(128, output_dim)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
x = self.fc1(x)
x = self.batch_norm1(x)
x = self.relu1(x)
x = self.dropout1(x)
x = self.fc2(x)
x = self.batch_norm2(x)
x = self.relu2(x)
x = self.dropout2(x)
x = self.fc3(x)
x = self.sigmoid(x)
return x