Skip to content

Replaced manual gating/blending with Gating/BlendingActivation classes.#192

Closed
jfsantos wants to merge 2 commits intosdatkinson:mainfrom
jfsantos:gating_blending
Closed

Replaced manual gating/blending with Gating/BlendingActivation classes.#192
jfsantos wants to merge 2 commits intosdatkinson:mainfrom
jfsantos:gating_blending

Conversation

@jfsantos
Copy link
Contributor

This PR replaces the manual gating implementation in wavenet.cpp by either a GatingActivation or a BlendingActivation instance and makes those configurable.

I implemented backwards compatibility with older config files that expect gated to be boolean, and also implemented backwards-compatible constructors that can take gated as a boolean instead of the enum I created. We can remove those if not needed, but they are here for completeness.

Developed with support and sponsorship from TONE3000

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.

Few things I might prefer done a little differently.

Mainly:

  1. Leave backward compatibility only at the factory, remove it from the constructors so there's "only one way to do it."
  2. Remove default "Sigmoid secondary activations, requiring them to be specified as well.

Honestly, these are a bit "nit"ty but I think that removing the old code paths now will maybe be worth it with a bit more clarity, focusing the backward compatibility into one spot.

I'll take care of 'em and get this merged here

const std::string blending_activation;

// Backward compatibility constructor with boolean gated parameter
LayerArrayParams(const int input_size_, const int condition_size_, const int head_size_, const int channels_,
Copy link
Owner

Choose a reason for hiding this comment

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

I'm gonna refactor this so that all of the backward compatibility is in the factory, then all the constructors below that can be nice & fresh.

// Use the GatingActivation class
// Extract the blocks first to avoid temporary reference issues
auto input_block = this->_z.leftCols(num_frames);
auto output_block = this->_z.topRows(bottleneck).leftCols(num_frames);
Copy link
Owner

Choose a reason for hiding this comment

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

This is a bit tricky to me...so the bottom rows are for the gate/blend op, and the top are both for the main activation's input and the gating activation's output.

I'll make a note of this.

@sdatkinson
Copy link
Owner

Continuing this on #193

@sdatkinson sdatkinson closed this Jan 20, 2026
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