Hi @ptrblck ,
I was using the following code and got the similar error:
all_loss[phase] = torch.cat((all_loss[phase], loss.detach().view(1, -1)))

all_loss[phase] = torch.cat((all_loss[phase], loss.detach().view(1, -1)))
TypeError: expected Tensor as element 0 in argument 0, but got numpy.float32

I tried to print the output:
print(">>>>>", loss.detach().view(1, -1), type(loss.detach().view(1, -1)), loss.detach().view(1, -1).dtype)

and got:
>>>>> tensor([[0.4254]], device='cuda:0') <class 'torch.Tensor'> torch.float32
>>>>> tensor([[0.5419]], device='cuda:0') <class 'torch.Tensor'> torch.float32
Traceback (most recent call last):
  File "/home/banikr2/PycharmProjects/Blockface/Codes/Main.py", line 131, in <module>
    all_loss[phase] = torch.cat((all_loss[phase], loss.detach().view(1, -1)))
TypeError: expected Tensor as element 0 in argument 0, but got numpy.float32

Could you help to debug it?
Btw phase is just either train or val.