I was trying to convert a numpy array, as shown in the cell below, to a one-hot encoded vector. The shape of the input gt_arr is [N, H, W] and I wanted it to convert to [N,3,H,W] using the command below:
It doesn’t happen often but it happens randomly on some arrays. Am I doing something wrong here? Any help is much appreciated. Thank you in advance! and excuse me for my formatting skills.
Even I’m unable to reproduce the above results now. I’m not sure what caused this to happen but it was a strange result. I’ll post it here if I find something more or if I’m able to consistently reproduce the bad results. Thank you @ptrblck.
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.