You are not using self.weight
or any other parameters in your forward
method.
If you pass a simple tensor into this module, you won’t be able to call backward
on the two outputs.
Also, the usage of .data
is not recommended, so if you want to manipulate a parameter, please refer to this post.
PS: You also have a typo: you are using require_grad
instead of requires_grad
(which won’t fix the issue however).