Solved by mailcorahul in post #2 
              
              
                The tensor y will contain the target class index(from 0-9) instead of one hot encoded vector. That’s why the shape is of batch_size.