I am trying to combine vgg16 model with densenet121 model and I am having problems.
We are using 3×224×224 images.
I am a starter, so please explain clearly.
class MyEnsemble(nn.Module):
def init(self,modelA,modelB):
super(MyEnsemble,self).init()
self.modelA = modelA
self.modelB = modelB
self.classifier=nn.Linear(4,2)
  def forward(self,x1,x2):
        x1=self.modelA(x1)
        x2=self.modelB(x2)
        x=torch.cat((x1,x2),dim=1)
       x=self.classifier(F.relu(x))
  return x

model_combined=MyEnsemble(model_vgg16,model_densenet121)
x1,x2=torch.randn(1,256),torch.rand(1,64)
output=model_combined(x1,x2)
It gives Runtime Error: Expected object of device type cuda but got device type cpu for aegument #1 ‘self’ in call to _thnn_conv2d_forward