Skip to content

[BUGFIX, BREAKING] Make activation base class abstract, fix PReLU implementation#223

Merged
sdatkinson merged 4 commits intomainfrom
bugfix-activation
Feb 12, 2026
Merged

[BUGFIX, BREAKING] Make activation base class abstract, fix PReLU implementation#223
sdatkinson merged 4 commits intomainfrom
bugfix-activation

Conversation

@sdatkinson
Copy link
Owner

Fixes an issue where PReLU was (wrongly, silently) falling back to a no-op default.

Unfortunately, the apply(*data, size) signature is a bad choice for generalized activations like PReLU, where the shape of the array ought to be specifically matched. This adds to my other gripes like the contiguous-memory assumption that was the root cause of #101

Added tests that assert that the known unhappy path is caught.

Breaking change (w.r.t. v0.3) is that the base class is now abstract.

@sdatkinson sdatkinson merged commit 7dc58c2 into main Feb 12, 2026
2 checks passed
@sdatkinson sdatkinson deleted the bugfix-activation branch February 12, 2026 03:15
jfsantos pushed a commit to jfsantos/NeuralAmpModelerCore that referenced this pull request Feb 12, 2026
…lementation (sdatkinson#223)

* Make activation apply method pure virtual instead of no-op default

* Fix bugs

* Refactor to throw std::invalid_argument in debug mode, add tests
sdatkinson added a commit that referenced this pull request Feb 14, 2026
* Add profiling instrumentation for NAM building blocks

Adds a profiling framework (NAM/profiling.h, NAM/profiling.cpp) with
NAM_PROFILE_START()/NAM_PROFILE_ADD() macros and 14 timing categories.
Supports both desktop (std::chrono) and ARM Cortex-M7 (DWT cycle counter)
backends. Profiling is compile-time gated via -DNAM_PROFILING.

Instruments wavenet _Layer::Process() and _LayerArray::ProcessInner()
with per-category timing, and adds profiling reset/print calls to the
benchmodel tool.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fixed build flags for benchmodel

* Added a command line tool to output memory usage for a given .nam file

* Bugfix - checking that condition_dsp is not null in the JSON (#220)

* [BUGFIX, BREAKING] Make activation base class abstract, fix PReLU implementation (#223)

* Make activation apply method pure virtual instead of no-op default

* Fix bugs

* Refactor to throw std::invalid_argument in debug mode, add tests

* Add TONE3000 support note in README.md (#224)

* Replace hardcoded profiling struct with dynamic registry

  The Timings struct hardcoded 14 named fields, requiring manual updates
  to reset(), total(), print_results(), and every call site whenever a
  category was added or removed. Replace with a flat-array registry where
  types are registered at file scope via register_type(), returning an
  integer index for O(1) accumulation in the hot path.

  Also adds NAM_PROFILE_RESTART() macro to replace a raw #ifdef block
  in wavenet.cpp.

---------

Co-authored-by: João Felipe Santos <santosjf@pm.me>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Steven Atkinson <steven@atkinson.mn>
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.

1 participant