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

Disallow creating bad classification iterator #8042

Merged
merged 1 commit into from Jul 25, 2019

Conversation

@jxtps
Copy link
Contributor

commented Jul 24, 2019

When doing classification we need to know the numPossibleLabels. If it's set to -1, then we get obscure and confusing null-pointers when accessing labels deep down the stack of calling ComputationGraph.fit on the iterator. This PR blocks the user from shooting themselves in the foot.

Background

Ran into a weird null-pointer when calling fit on a classification network. My data looked pristine, and this was quite gnarly to track down. Turns out I had re-used some code from a segmentation task and was creating the iterator in the same way, but just passing in "false" for regression.

This lead to RecrodReaderMultiDataSetIterator having an empty outputs => no ComputationGraph.labels => null pointer on line 2627 in ComputationGraph.calcBackpropGradients.

Switching to another constructor solved the problem.

Caveat

There might be cases where calling this constructor with regression = false makes sense?

Disallow creating bad classification iterator
When doing classification we need to know the `numPossibleLabels`. If it's set to -1, then we get obscure and confusing null-pointers when accessing labels when calling `ComputationGraph.fit` on the iterator. This PR blocks the user from shooting themselves in the foot.
@AlexDBlack
Copy link
Contributor

left a comment

LGTM, thanks!

@AlexDBlack AlexDBlack merged commit 22993f8 into eclipse:master Jul 25, 2019

1 check failed

eclipsefdn/eca The author(s) of the pull request is not covered by necessary legal agreements in order to proceed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.