I am new to Pytorch and need some help. I have a simple ANN:
n_in, n_h0, n_h1, n_h2, n_out, batch_size = 12, 0, 0, 0, 8, 32
self.fc1 = nn.Linear(n_in, n_out)
def forward(self, x):
x = self.fc1(x)
x = nn.Tanh()(x)
model = Net()
I want to change some weights by myself. I try:
model.fc1.weight = 0.5
This changes in model.fc1.weight:
requires_grad=True to grad_fn=CopySlices>
Also if i now train the model i get the message: ValueError: can’t optimize a non-leaf Tensor.
Can someone please help how to do it ?