GenBaB / cifar /models /tanh.py
zhouxingshi's picture
Move files
c303ecb
raw
history blame contribute delete
530 Bytes
import torch.nn as nn
def tanh_fc(in_ch=3, in_dim=32, width=100, depth=4, num_classes=10):
layers = [nn.Flatten(), nn.Linear(in_ch*in_dim**2, width), nn.Tanh()]
for _ in range(depth - 1):
layers.extend([nn.Linear(width, width), nn.Tanh()])
layers.append(nn.Linear(width, num_classes))
return nn.Sequential(*layers)
def tanh_4fc_100(in_ch=3, in_dim=32):
return tanh_fc(in_ch, in_dim, width=100, depth=4)
def tanh_6fc_100(in_ch=3, in_dim=32):
return tanh_fc(in_ch, in_dim, width=100, depth=6)