Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG] Inactive layer1x1 drops the activation from the WaveNet residual path

オープン
#341 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp

調査の方向性

Start in NAM/wavenet/model.cpp at _Layer::Process and inspect the inactive-layer1x1 branch in both the Eigen and NAM_USE_INLINE_GEMM paths. Compare its residual handling with nam/models/wavenet/_layer_array.py, lines 755–773, where the trainer adds post_activation to x. Done means the core output matches the trainer for an inactive layer1x1 model, including the reported residual-path comparison.

索引モデルが issue の本文から書いたものです。

説明

Summary

When a WaveNet layer has "layer1x1": {"active": false} (.nam 0.7 format), the core passes the residual input through unchanged instead of adding the layer's activation output to it. The trainer (neural-amp-modeler) computes x + post_activation in that case, so the core's output diverges from the trainer's for such models.

Where

  • Core (main @ 0b3d3c97b0, also v0.5.4): NAM/wavenet/model.cpp, _Layer::Process… inactive-layer1x1 branch (around line 385):
    // If layer1x1 is inactive, residual connection is just the input (identity)
    ...memcpy(... input.data() ...)            // NAM_USE_INLINE_GEMM path
    this->_output_next_layer.leftCols(num_frames).noalias() = input.leftCols(num_frames);  // Eigen path
    
  • Trainer (main @ 0072676419): nam/models/wavenet/_layer_array.py, lines ~755–773:
    layer_output = post_activation
    if self._layer1x1 is not None:
        layer_output = self._layer1x1(layer_output)
        ...
    residual = x[:, :, -layer_output.shape[2]:] + layer_output
    
    i.e. with layer1x1 inactive the residual is x + post_activation, not x.

Impact

On a model exported by neural-amp-modeler 0.13.0 with layer1x1 inactive on one layer array, the core's output differed from the trainer's PyTorch output (pad_start=True) by up to ~0.4 on that array and ~1.9e-3 at the model output. With the residual add restored, the core matches the trainer to ~6e-8.

Suggested fix

In the inactive branch, add the activation output (the bottleneck rows of _z) to the input instead of copying it, in both the Eigen path and the NAM_USE_INLINE_GEMM path, e.g. for the Eigen path:

this->_output_next_layer.leftCols(num_frames).noalias() =
  input.leftCols(num_frames) + this->_z.topRows(bottleneck).leftCols(num_frames);

(Assuming bottleneck == channels is required when layer1x1 is inactive, as the residual shapes imply.)

主要言語
C++
スター
955
フォーク
183
平均マージ
36分
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sdatkinson/NeuralAmpModelerCore のほかの issue

sdatkinson/NeuralAmpModelerCore の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。