d2l-ai / d2l-en

Interactive deep learning book with multi-framework code, math, and discussions. Adopted at 500 universities from 70 countries including Stanford, MIT, Harvard, and Cambridge.
https://D2L.ai
Other
24.04k stars 4.37k forks source link

Fix pytorch version of custom-layer to allow auto grad #2600

Open zhouzhiwen2000 opened 5 months ago

zhouzhiwen2000 commented 5 months ago

self.weight’ and ‘self.bias’ should be used instead of ‘self.weight.data’ and ‘self.bias.data’ to make sure that BP works for weight and bias.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.