pytorch是否提供某种model.train_on_entire_thing(x, y, iterations=1000)
方法?我找不到这是我知道的最短的代码:
import torch
x = random
y = random
model = sequential layers
loss_fn = mean squared error
optimizer = adam
loop 1000 times:
predict x
take loss
zero gradients
send backword
step the optimizer
我想在一行中执行该循环。