Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt <-> optimizer parameter #70

Open
learniotai opened this issue Jul 15, 2023 · 2 comments
Open

opt <-> optimizer parameter #70

learniotai opened this issue Jul 15, 2023 · 2 comments

Comments

@learniotai
Copy link

The function

def train_batch(x, y, model, opt, loss_fn):
    prediction = model(x)[0]
    batch_loss = loss_fn(prediction, y)
    batch_loss.backward()
    optimizer.step()
    optimizer.zero_grad()

has parameter opt and then uses optimizer which isn't passed in so it must be using a global value.

@19valentin99
Copy link

Just to mention: it is useful to mention where in the book you encountered this error (at least the Chapter)

@Camaltra
Copy link

Seen on the Chap4 (CNN_working_details.ipynb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants