Thank you for your answer. I tried to do something and solved an error but another error occured. I like getting errors.
model_ensemb = MyEnsemble(model_vgg, model_dense)
model_ensemb.to('cuda')
x1, x2 = torch.randn(64, 3,3,3).to('cuda'), torch.randn(64,3,3,3).to('cuda')
output = model_ensemb(x1, x2)
Here is error->
RuntimeError Traceback (most recent call last)
<ipython-input-38-0a8154c58d2a> in <module>()
2 model_ensemb.to('cuda')
3 x1, x2 = torch.randn(64, 3,3,3).to('cuda'), torch.randn(64,3,3,3).to('cuda')
----> 4 output = model_ensemb(x1, x2)
9 frames
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in _max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode, return_indices)
486 stride = torch.jit.annotate(List[int], [])
487 return torch.max_pool2d(
--> 488 input, kernel_size, stride, padding, dilation, ceil_mode)
489
490 max_pool2d = boolean_dispatch(
RuntimeError: Given input size: (128x1x1). Calculated output size: (128x0x0). Output size is too small
Here is classifier for Densenet121->
(classifier): Sequential(
(0): Linear(in_features=1024, out_features=256, bias=True)
(1): ReLU()
(2): Dropout(p=0.2, inplace=False)
(3): Linear(in_features=256, out_features=2, bias=True)
(4): LogSoftmax()
)
)
(classifier): Linear(in_features=4, out_features=2, bias=True)
And here is classifier for VGG16->
(classifier): Sequential(
(0): Linear(in_features=25088, out_features=4096, bias=True)
(1): ReLU(inplace=True)
(2): Dropout(p=0.5, inplace=False)
(3): Linear(in_features=4096, out_features=4096, bias=True)
(4): ReLU(inplace=True)
(5): Dropout(p=0.5, inplace=False)
(6): Sequential(
(0): Linear(in_features=4096, out_features=256, bias=True)
(1): ReLU()
(2): Dropout(p=0.2, inplace=False)
(3): Linear(in_features=256, out_features=2, bias=True)
(4): LogSoftmax()
)