-
Notifications
You must be signed in to change notification settings - Fork 101
Added multichannel PReLU #179
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
Conversation
sdatkinson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few changes noted
sdatkinson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_per_channel_behavior seems sus. Mind checking for me?
| // Apply the negative slope to all time steps in this channel | ||
| for (int time_step = 0; time_step < matrix.rows(); time_step++) | ||
| { | ||
| matrix(channel, time_step) = leaky_relu(matrix(channel, time_step), negative_slopes[channel]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Feels inefficient since there's no vectorized ops being used, but we'll see.
tools/test/test_activations.cpp
Outdated
| // Channel 1 (slope = 0.05): | ||
| assert(fabs(data(1, 0) - (-0.10f)) < 1e-6); // -2.0 * 0.05 = -0.10 | ||
| assert(fabs(data(1, 1) - (-0.025f)) < 1e-6); // -0.5 * 0.05 = -0.025 | ||
| assert(fabs(data(1, 2) - 0.0f) < 1e-6); // 0.0 (unchanged) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange that these would pass if I'm not mistaken...
sdatkinson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻
Adding a multichannel PReLU to activations. This activation is different from the others because it can have one negative slope for each channel, so it needs to know how many channels the input has. API for activation was extended to include an
apply(MatrixXf matrix)for that case. The basicapply(float* data, long size)call will behave exactly like LeakyReLU and ignore the input shape.Developed with support and sponsorship from TONE3000