Thank you for quick response,
model is working for below snippet but is it appropriate to define “device” in forward block?
def forward(self, *x):
device = torch.device (“cuda” if torch.cuda.is_available() else “cpu”)
feature_size = x[0].size()
y = [0]*self.n_modalities
for i, d in enumerate(x):
self.C[i] = self.C[i].to(device)
    y[i] = d.mm(self.C[i]).view(feature_size[0], -1)