I can confirm print(noise_and_labels.shape, type(noise_and_labels[0][0].item())) returns torch.Size([128, 74]) <class ‘float’> for me as well. I suspect there’s something wrong in Generator class code. Please allow me some time to try to reproduce your error. Will get back to you asap.
Will you be able to confirm you’re casting tensors to float (in combine_vectors) as follows x.type(torch.float)? Also will you be able to submit the full error call stack for better understanding because I’m unable to reproduce the error on my end. Many thanks.
I’ve reproduced your error by casting noise_and_labels to torch.cuda.DoubleTensor as follows fake = gen(noise_and_labels.type(torch.cuda.DoubleTensor))
As a workaround I suggest to cast noise_and_labels to torch.cuda.FloatTensor as follows fake = gen(noise_and_labels.type(torch.cuda.FloatTensor)).
Many thanks.
Despite passing the tests I got 0 grade upon submission. After some additional attempts based on the error messages I realized that
(1) the grader uses a PyTorch version that does not have concat, I had to change to torch.cat instead, and
(2) in grader’s test the combine function can get inputs of different types, so one must convert the inputs before concatenation, and not the combined output.
I too ran into this problem. Even though my combine_vectors passed with torch.tensor(torch.cat((x,y), dim=1), dtype=torch.float64), I had to cast the output as suggested above, using gen(noise_and_labels.type(torch.cuda.FloatTensor))