Torch.nn.functional.one_hot not working as expected

I apologize for shooting this question here before thorough analysis. I ran memtest on my RAM and found out that several memory locations on one of my RAMs were corrupt and were returning wrong results during read operation, hence the unexpected output.