Skip to content

Conversation

@jfsantos
Copy link
Contributor

Adding abstractions for gating activations and blending activations. These classes are both very similar: they take two activations (and a blending coefficient alpha for blending activations). One activation is used for channel 0 of the input (the "input activation" in the code) and the other is used for channel 1 (the "gating activation" in the code). The difference between the two is that gating activation uses the activation of the second channel as a gate, while blending activation sums both channels scaled by alpha and (1-alpha).

Developed with support and sponsorship from TONE3000

@jfsantos
Copy link
Contributor Author

By the way, this might have an impact on performance since I am calling .array() on MatrixXf blocks to make them contiguous so I can do other operations with them. We should profile it in the future to make sure it's not significant, and if that is the case see if we can optimize the implementation.

Copy link
Owner

@sdatkinson sdatkinson left a comment

Choose a reason for hiding this comment

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

Couple call-outs

Copy link
Owner

@sdatkinson sdatkinson left a comment

Choose a reason for hiding this comment

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

Haven't gotten to the tests yet, but blending activation isn't quite right.

…ctivation. Removed all runtime checks and replaced with asserts.
Copy link
Owner

@sdatkinson sdatkinson left a comment

Choose a reason for hiding this comment

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

Nits but nothing critical 👍🏻


nam::gating_activations::GatingActivation gating_act(nullptr, nullptr, channels);

// This should not crash or produce incorrect results due to memory contiguity issues
Copy link
Owner

Choose a reason for hiding this comment

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

Nit: This might be done better...but the numerical assertions are reasonable, and when this gets combined with the better real-time saftey testing in the Conv1D PR we'll be in good shape.

@sdatkinson sdatkinson merged commit c0a1e13 into sdatkinson:main Jan 14, 2026
1 check passed
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.

2 participants