Hello all,
I have query regarding the placement of optimizer.zero_grad() and optimizer.step()
for idx in range(epoch):
for kdx in range(batch):
y_pred = model(X)
loss = loss_fn(y_pred,y_target)
optimizer.zero_grad()
loss.backward()
optimizer.step()
Do we need to call them once for every epoch or for every batch iteration?