Yes, I realize that I have initialized hidden_x incorrectly, thanks for pointing that.
However, the GPU and CPU codes are almost the same, so why does the code run in the CPU mode and not the GPU mode?