clovaai / CutMix-PyTorch

Official Pytorch implementation of CutMix regularizer
MIT License
1.22k stars 159 forks source link

error about torch.nn.functional.one_hot #11

Closed NomiMalik0207 closed 4 years ago

NomiMalik0207 commented 4 years ago

I am trying this code but got error about AttributeError: module 'torch.nn.functional' has no attribute 'one_hot' but i have latest verision of pytorch

hellbell commented 4 years ago

@NomiMalik0207 Could you tell me which line of our code raises that error?

NomiMalik0207 commented 4 years ago

while testing i got an error on line target = torch.nn.functional.one_hot(target, num_classes=input.size(-1)) Attribute error that one_hot is not module in torch.nn.functional, i am using python 3.5 with latest verision of pytorch

hellbell commented 4 years ago

@NomiMalik0207 There's no target = torch.nn.functional.one_hot(target, num_classes=input.size(-1)) in our repository. I guess you are probably confused with other implementation.

NomiMalik0207 commented 4 years ago

yes, actually i also want to use soft verision of cross entroy loss

hellbell commented 4 years ago

@NomiMalik0207 Again, we didn't use one_hot function to get mixed cross-entropy loss. We aggregate two loss values with weight values as in https://github.com/clovaai/CutMix-PyTorch/blob/master/train.py#L246. Your problem is not related to our implementation and seems to be related to pytorch version.

NomiMalik0207 commented 4 years ago

thank you ... have solved it. using your rapo