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

Determine batch size from labels instead of inputs #58

Merged
merged 1 commit into from Jul 25, 2020

Conversation

NaleRaphael
Copy link
Contributor

Fix issue #57, and related tests are added.

In `LRFinder._validate()`, batch size was determined by given
`inputs` dynamically. However, `inputs` might not be tensors
or list of tensors in some cases, and that makes it not able to
determine batch size from `inputs.size()` or `inputs[0].size()`.

In this revision, we change to code to determine batch size from
`labels` since all loss functions expecting the `labels` to be a
tensor (reviewed by @davidtvs). And it keeps the compatibility
to work with non-full batch (e.g. when `drop_last` of a
`DataLoader` is True).
@davidtvs
Copy link
Owner

/flake8-lint

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No linting violations have been found in this PR.

@davidtvs
Copy link
Owner

davidtvs commented Jul 25, 2020

LGTM. Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants