As the error message explains, you have to assign nn.Parameter
objects to the internal parameters, not tensors.
Based on your code snippet you would have to wrap the a
tensor into nn.Parameter(a)
and assign it to the weight
.
Also note that you are creating a new model instance and are removing it directly in:
ConvAutoencoder().conv3.weight=a
so you most likely want to assign a variable to the model creation.
Is this a double post from here or what it the difference between both posts?