I was able to figure out the issue, and it was unrelated to the dataloader.
I realized the issue was not with loading npy itself. The issue was with the size of the tensor before inserting it in the neural network. After changing the tensor size, I was able to resolve the issue. This seems quite obvious to me in hindsight, but since I was deal with a new datatype I assumed the issue was with it.
Note: For anyone else interested in designing a npy dataloader you can refer to this thread.