GNNLux MEGNetConv drops the state of stateful sublayers

オープン 初心者向け
#732 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

MEGNetConvのforward passを読み、EdgeConv、GINConv、NNConvが更新されたサブレイヤーの状態をどのように返すか比較してください。ϕeでBatchNormを使用する回帰テストを追加し、trainingモードで呼び出した後にその実行統計が変化するかを確認してください。次に、更新された状態が返された場合にテストが通ることを確認してください。

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

説明

lux

GNNLux.MEGNetConv wraps ϕe and ϕv in StatefulLuxLayer{true}, but its forward pass returns the input state unchanged:

function (l::MEGNetConv)(g, x, e, ps, st)
    ϕe = StatefulLuxLayer{true}(l.ϕe, ps.ϕe, _getstate(st, :ϕe))
    ϕv = StatefulLuxLayer{true}(l.ϕv, ps.ϕv, _getstate(st, :ϕv))
    m = (; ϕe, ϕv, aggr=l.aggr)
    return GNNlib.megnet_conv(m, g, x, e), st
end

Any state update performed by a sublayer is therefore dropped. The default constructor only builds Dense chains, which are stateless, but the MEGNetConv(in_dims, out_dims, ϕe, ϕv; aggr) constructor accepts arbitrary layers. With a stateful one, e.g. BatchNorm or Dropout inside ϕe/ϕv, the running statistics (or RNG) never advance in training mode.

The same pattern is already used by EdgeConv, GINConv and, since #728, NNConv:

stnew = (; ϕe = _getstate(ϕe), ϕv = _getstate(ϕv))
return GNNlib.megnet_conv(m, g, x, e), stnew

This was found by reading the code while reviewing #728 and has not been reproduced yet; a regression test with a BatchNorm in ϕe (checking that the running stats change after a training-mode call) would pin it down. Related: #727.

The other layers with sublayer fields (CGConv, EGNNConv, GATConv, GATv2Conv, GMMConv, GatedGraphConv) have the same return-st pattern, but their constructors only create Dense/Chain of Dense sublayers (plus a GRUCell in GatedGraphConv, whose rng state doesn't appear to be used there), so nothing seems to be lost in practice.

🧔‍♂️🤖 Assisted by AI

主要言語
Julia
スター
310
フォーク
75
平均マージ
2日 15時間
マージ済み PR(30日)
10

環境構築

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

はじめの一歩

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

JuliaGraphs/GraphNeuralNetworks.jl のほかの issue

JuliaGraphs/GraphNeuralNetworks.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

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

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