Added multichannel PReLU#179
Merged
Merged
Conversation
sdatkinson
requested changes
Jan 14, 2026
sdatkinson
reviewed
Jan 14, 2026
sdatkinson
left a comment
Owner
There was a problem hiding this comment.
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]); |
Owner
There was a problem hiding this comment.
Nit: Feels inefficient since there's no vectorized ops being used, but we'll see.
| // 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) |
Owner
There was a problem hiding this comment.
Strange that these would pass if I'm not mistaken...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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