Skip to content

Difference between torch one_hot and ignite to_onehot #1550

Answered by vfdev-5
ydcjeff asked this question in Q&A
Discussion options

You must be logged in to vote

Besides those differences, is there any other differences or any other specific use case?

I think that's it. uint8 vs long is about memory impact. We put num_classes to dim=1 such that targets with shapes like (B, H, W) can be easily transformed to one-hot targets (B, C, H, W).

Replies: 1 comment 1 reply

Comment options

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

Answer selected by ydcjeff
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