Assign custom weight

I want to assign custom weights to my model but it doesn’t work correctly.

the output is expected to be [1, 2, 3, 4, 5] but isn’t as expected. What am I missing here? I would really appreciate it if someone helps me.

mod.linear is the nn.Sequential container not the nn.Linear layer. You are assigning new .weight and .bias attribute to nn.Sequential which won’t be used.

PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier.