I am experimenting Autoencoder with Pytorch. It seems when I use relatively larger neural network for instance nn.Linear(250*250, 40*40) as the first layer, the Jupyter kernel keep crashing. when I use smaller layer size eg nn.Linear(250*250, 20*20). the Jupyter kernel is ok. Any idea how to fix this? So I can run larger network.Thank you. The entire network is as below.
# model:
class AutoEncoder(nn.Module):
def __init__(self):
super().__init__()
self.encoder = nn.Sequential(
nn.Linear(250*250, 20*20),
nn.BatchNorm1d(20*20,momentum=0.5),
nn.Dropout(0.5),
nn.LeakyReLU(),
nn.Linear(20*20, 20*20),
nn.BatchNorm1d(20*20,momentum=0.5),
nn.Dropout(0.5),
nn.LeakyReLU(),
nn.Linear(20*20, 20*20),
nn.BatchNorm1d(20*20,momentum=0.5),
nn.Dropout(0.5),
nn.LeakyReLU(),
nn.Linear(20*20, 15*15),
nn.BatchNorm1d(15*15,momentum=0.5),
nn.Dropout(0.5),
nn.LeakyReLU(),
nn.Linear(15*15, 3),
nn.BatchNorm1d(3,momentum=0.5),
#nn.Dropout(0.5),
#nn.Tanh(),
#nn.Linear(5*5,5),
)
self.decoder = nn.Sequential(
#nn.Linear(5, 5*5),
#nn.BatchNorm1d(5*5,momentum=0.5),
#nn.Dropout(0.5),
#nn.Tanh(),
nn.Linear(3, 15*15),
nn.BatchNorm1d(15*15,momentum=0.5),
nn.Dropout(0.5),
nn.LeakyReLU(),
nn.Linear(15*15, 20*20),
nn.BatchNorm1d(20*20,momentum=0.5),
nn.Dropout(0.5),
nn.LeakyReLU(),
nn.Linear(20*20, 20*20),
nn.BatchNorm1d(20*20,momentum=0.5),
nn.Dropout(0.5),
nn.LeakyReLU(),
nn.Linear(20*20, 250*250),
nn.BatchNorm1d(250*250,momentum=0.5),
nn.Dropout(0.5),
nn.Sigmoid(),
)
def forward(self, x):
encoded = self.encoder(x)
decoded = self.decoder(encoded)
return encoded, decoded
I have found the root cause. I am running a docker ubuntu image/package on windows. the memory setting is set too low, when I increase the memory setting on docker. my ubuntu environment got more memory, then I can larger matrix operations.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.