Hi I am new to pytorch I am trying to implement Squeezenets but when I run my code the kernel in the notebook dies just for one convolutional layer can someone help me debug the issue please
Code :
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import skimage.io as io
import os
from skimage.transform import resize

def create_data(location):
    all_types = sorted(os.listdir(location))
    images = []
    labels = []
    k = -1
    for i in all_types:
        all_files = sorted(os.listdir(location+"/"+i))
        k = k + 1
        for j in all_files:
            images.append(Variable(torch.from_numpy(resize(io.imread(location+"/"+i+"/"+j),(224,224,3)).reshape(3,224,224).astype(np.float)),requires_grad = True))
            labels.append(k)
    
    return images,labels

class Squeezenet(nn.Module):
    def __init__(self):
        super(Squeezenet,self).__init__()
        self.conv1 = nn.Conv2d(3,96,7,stride=2)
        self.maxpool1 = nn.MaxPool2d(3,stride = 2)
        self.s11 = nn.Conv2d(96,16,1,stride = 1)
        self.e11 = nn.Conv2d(16,64,1,stride = 1)
        self.e13 = nn.Conv2d(16,64,3,stride = 1)
        self.s21 = nn.Conv2d(128,16,1,stride = 1)
        self.e21 = nn.Conv2d(16,64,1,stride = 1)
        self.e23 = nn.Conv2d(16,64,3,stride = 1)
        self.s31 = nn.Conv2d(128,32,1,stride = 1)
        self.e31 = nn.Conv2d(32,128,1,stride = 1)
        self.e33 = nn.Conv2d(32,128,3,stride = 1)
        self.maxpool2 = nn.MaxPool2d(3,stride=2)
        self.s41 = nn.Conv2d(256,32,1,stride = 1)
        self.e41 = nn.Conv2d(32,128,1,stride = 1)
        self.e43 = nn.Conv2d(32,128,3,stride = 1)
        self.s51 = nn.Conv2d(256,48,1,stride = 1)
        self.e51 = nn.Conv2d(48,192,1,stride = 1)
        self.e53 = nn.Conv2d(48,192,3,stride = 1)
        self.s61 = nn.Conv2d(384,48,1,stride = 1)
        self.e61 = nn.Conv2d(48,192,1,stride = 1)
        self.e63 = nn.Conv2d(48,192,3,stride = 1)
        self.s71 = nn.Conv2d(384,64,1,stride = 1)
        self.e71 = nn.Conv2d(64,256,1,stride = 1)
        self.e73 = nn.Conv2d(64,256,3,stride = 1)
        self.maxpool3 = nn.MaxPool2d(3,stride=2)
        self.s81 = nn.Conv2d(512,64,1,stride = 1)
        self.e81 = nn.Conv2d(64,256,1,stride = 1)
        self.e83 = nn.Conv2d(64,256,3,stride = 1)
        self.conv2 = nn.Conv2d(512,1000,1,stride = 1)
        self.avgpool = nn.AvgPool2d(13,stride = 1)
        self.fc1 = nn.Linear(1000,2)
    
    def forward(self,x):
        print x.size()
        x = self.conv1(x)
#         print x.size
#         x = self.maxpool1(x)
#         print x.size
#         x = torch.cat(self.e11(self.s11(x)),self.e13(self.s11(x)))
#         print x.size
#         x = torch.cat(self.e21(self.s21(x)),self.e23(self.s21(x)))
#         print x.size
#         x = torch.cat(self.e31(self.s31(x)),self.e33(self.s31(x)))
#         print x.size
#         x = self.maxpool2(x)
#         print x.size
#         x = torch.cat(self.e41(self.s41(x)),self.e43(self.s41(x)))
#         print x.size
#         x = torch.cat(self.e51(self.s51(x)),self.e53(self.s51(x)))
#         print x.size
#         x = torch.cat(self.e61(self.s61(x)),self.e63(self.s61(x)))
#         print x.size
#         x = torch.cat(self.e71(self.s71(x)),self.e73(self.s71(x)))
#         print x.size
#         x = self.maxpool3(x)
#         print x.size
#         x = torch.cat(self.e81(self.s81(x)),self.e83(self.s81(x)))       
#         print x.size
#         x = self.conv2(x)
#         print x.size
#         x = self.avgpool(x)
#         print x.size
#         x = self.fc1(x.view(1,-1))
#         print x.size
        return x

net = Squeezenet()
img,lbl = create_data("/home/adithya/skin_le/train_dat") 
net(img[0].view(1,3,224,224)) #this an error of dying kernel