Prediction error while generating confusion matrix

Hi, after trying a couple of solutions I am getting two errors. I have my model.to(device) defined and all the simulation runs correctly. The problem appears just while evaluation of the code with a confusion matrix in this piece of code:

heatmap of confusion matrix

truelabels = []
predictions = []
model.eval()
print(“Getting predictions from test set…”)
for data, target in test_loader:
data = data.cpu().numpy()
# data.to(device=device, dtype=torch.cuda.float)
# data, target = data.to(device).cpu(), target.to(device).cpu()
# data = torch.from_numpy(data).float().to(‘cuda’)
# target = target
for label in target.numpy():
truelabels.append(label)
for prediction in model(data).data.argmax(1):

    predictions.append(prediction)

I m getting either this. I tried to put it data.to(cuda),
then I also tried to put data.cpu.numpy(), but nothing really works… I would be greatful for any help

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same.
or
TypeError: conv2d(): argument ‘input’ (position 1) must be Tensor, not numpy.ndarray

SOLVED:

In calss function:
def forward(self,x):

adding

x =x.cuda()

and adding
for prediction in model(data).data.**cpu().**numpy().argmax(1):

    predictions.append(prediction)