Ah OK, yes the error is thrown as you cannot multiply a scalar with a list directly.



 Mahmoud_Ghorbel:

but still dont know how to learn the best valur of the weight, i just take 0.2 randomly


I’m still unsure, if “learning” the weight would work, since it would just push it to a negative value.
However, if you want to use the weight as a trainable parameter, refer to my code snippet from my previous post.