Hi, Shen Li,
Thanks a lot for pointing this out. Those .to(self.device) were not there, I added them because I am trying to get rid of the error message. This is due to several posts saying that any layer of the model not defined in the init() but used in forward() should add .to(device).
Even if I remove all .to(self.device) from forward(), the error is still there.
I was thinking the error might be caused by def matrix_rep(self, x) which is defined outside of init() but used in forward(), but I have no idea how to modify it.