(labels[i] == predicted[i]).all() should work. However, I don’t think this will yield your desired result as it seems you expect to compare scalar values instead of tensors, so I would still recommend to check the shape and make sure the indexing works as expected.