I changed my script because i think it will run if i just use the right functions etc. However the script looks like this now :
lossfct = torch.nn.modules.loss.CrossEntropyLoss()
# optimizer settings
optimizer = torch.optim.RMSprop(VRN.parameters(), lr=0.1)

voxel_array = torch.from_numpy(voxel_array)
voxel_array = voxel_array.long()

for epoch in range(10):
    print(epoch)
    VRN.train()
    predicted_model = VRN.forward(inp)
    # vol = predicted_model.numpy()
    # vol = predicted_model.numpy()
    # voxel_array = voxel_array.squeeze(0)
    # vol = torch.from_numpy(vol)
    loss = lossfct(predicted_model[0], voxel_array)
    print(loss)
    loss.backward()
    optimizer.step()

but it produces the following error :
RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of dimension: 4

However if i Squeeze, i get Tensor Erros. How could i fix this?
My Shape is [1, 384, 384, 384] for Target and the same for model-output. However, i dont know how too Add the C as in CrossEntropyLoss mentioned since i got like “unlimited” classes theoretically. So it simply does not make that much sense for me. But without the C i always get a Batch_size or Dimension Error