A leaf variable is a variable, which you created directly and which is not a result of an operation.
So in your case the parameters of your model are leaf variables and shouldn’t be modified in-place.
You can check if with:
m.weight.is_leaf
Using .data
is still the way to go to initialize your model. @tom has a nice explanaition in this post.
.data
wasn’t removed in the latest version and still has similar semantics. Have a look at the Migration Guide.