Skip to content

RuntimeError: expected scalar type Long but found Float #888

Answered by LuluW8071
garvpatidar04 asked this question in Q&A
Discussion options

You must be logged in to vote

Typical datatype error
Just change ytrain1 to long dtype. This is done for labels since labels should be fixed value not floating points.

Paste below snippet above your training loop code

y_train1 = y_train1.type(torch.LongTensor)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@garvpatidar04
Comment options

Answer selected by garvpatidar04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants