nn.ReLU()
)
self.max_pooling2_1=nn.MaxPool2d(kernel_size=2,stride=1)
#4*4
self.conv2_2=nn.Sequential(
nn.Conv2d(24,24,kernel_size=3,stride=1,padding=1),
nn.ReLU()
)
self.max_pooling2=nn.MaxPool2d(kernel_size=2,stride=2)
#2*2
#2*2
self.fc=nn.Linear(24*2*2,2)
defforward(self,x):
batchsize=x.size(0)
out=self.conv1(x)
out=self.max_pooling1(out)
out=self.conv2_1(out)
out=self.conv2_2(out)
out=self.max_pooling2(out)
out=out.view(batchsize,-1)
out=self.fc(out)
out=F.log_softmax(out,dim=1)
returnout
classTrainingDataSet(Dataset):
def__init__(self):
super(TrainingDataSet,self).__init__()
self.data_dict_X=X_train
self.data_dict_y=y_train
def__getitem__(self,index):
t=self.data_dict_
本章未完,请点击下一页继续阅读! 第2页 / 共10页