I calling detach() in class CBA, I think it only lets the program correct, but the result is incorrect. Finally, I find is because of the data processing. I use torchtext to embedding the data and then using Pytorch DataSet and DataLoader to wrap the data. When I process data using torchtext only, the problem is solved, and the result is correct.
But I don’t know why this happened, do you have any idea? Thanks