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

Clip layer - resurrection #6320

Merged
merged 3 commits into from
Aug 20, 2018
Merged

Clip layer - resurrection #6320

merged 3 commits into from
Aug 20, 2018

Conversation

Noiredd
Copy link
Member

@Noiredd Noiredd commented Mar 30, 2018

#3791 introduced a clip layer to constrain activations to some predefined range of values. It had some problems with unit tests however:

sometimes an input value will land near the function's discontinuity (...) [which] causes the gradient estimate to be different than the computed value

This is a resubmission of that PR, with modified gradient tests: values that fall within the discontinuity regions are excluded from the blob before the GradientChecker runs.

Closes #3791

@Noiredd Noiredd merged commit dc6d330 into BVLC:master Aug 20, 2018
@Noiredd Noiredd deleted the clip branch August 20, 2018 05:55
@shelhamer
Copy link
Member

@Noiredd for testing you could consider the kink, kink_range arguments of GradientChecker as used in the absolute value gradient test for instance https://github.com/BVLC/caffe/blob/master/src/caffe/test/test_neuron_layer.cpp#L205. Note however that this can only handle a single non-smooth region, so you would have to test the lower and upper extremes of the clipping separately, which is less than ideal.

Of course your test handles everything just fine by handling the clipping boundaries itself. I thought I would mention the kink setting of the gradient checker in case it is useful elsewhere since it is not often invoked.

@Noiredd
Copy link
Member Author

Noiredd commented Aug 24, 2018

Oooh, so this is what kink and kink_range do. Thanks for the hint, I'll pay attention to them next time.

XinYao1994 pushed a commit to XinYao1994/caffe that referenced this pull request Aug 29, 2018
beniz pushed a commit to jolibrain/caffe that referenced this pull request Sep 24, 2018
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.

3 participants