Fix long time step() detach
This commit is contained in:
parent
838af9cf4c
commit
9634ab12c5
2 changed files with 2 additions and 3 deletions
Binary file not shown.
5
test.py
5
test.py
|
|
@ -97,7 +97,7 @@ if __name__ == "__main__":
|
|||
input_list = [[0.5 for _ in range(100)]]
|
||||
input = norch.Tensor(input_list).T
|
||||
criterion = nn.MSELoss()
|
||||
optimizer = norch.optim.SGD(modelo.parameters(), lr=0.05)
|
||||
optimizer = norch.optim.SGD(modelo.parameters(), lr=0.1)
|
||||
|
||||
target_list = [[random.random() for _ in range(2)]]
|
||||
target = norch.Tensor(target_list).T
|
||||
|
|
@ -111,9 +111,8 @@ if __name__ == "__main__":
|
|||
optimizer.zero_grad()
|
||||
|
||||
loss.backward()
|
||||
#print('fora grad', modelo.layer1.weight.grad, "\n\n")
|
||||
optimizer.step()
|
||||
print(loss)
|
||||
#print(loss)
|
||||
|
||||
fim = time.time()
|
||||
print(fim - ini)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue