Skip to content

Conversation

RichSweetWafer
Copy link

Hi!

I've recently encountered a problem during training process of our model. The problem itself is not so important (division by zero during back propagation in cross_entropy_error.cpp), because I can see that dev branch has changed a lot since the last release version. But I see that what I lacked during debugging has not been addressed yet: reproducibility. Randomization is good, but controlled randomization is even better. Frameworks like PyTorch try to provide ways to reduce the number of nondeterministic behavior. One way is to implement a global RNG, which is what was done in this PR.

The user just has to write something like

std::random_device rd;
setGlobalSeed(rd());

before using the library.

This is a somewhat "foundational" code, some basic stuff to improve upon in the long run. Now, I don't know the codebase as well as you guys do, so I expect some notes being made and mistakes highlighted, if you will consider this idea.

{
if (dropout_rate >= type(1))
{
throw runtime_error("Dropout rate should be in range [0, 1). Got: " + std::to_string(dropout_rate));
Copy link
Author

Choose a reason for hiding this comment

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

Also, there probably should be a runtime error if dropout function uses rate that is too high

@RichSweetWafer
Copy link
Author

Come to think of it, maybe the global RNG should be seeded randomly by default to write less code.

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.

1 participant