GroupNorm changes the batch size when input resolution changes between calls
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python, tensorflow
- Ambito
- machine-learning
Direzione di ricerca
Inizia da sonnet/src/group_norm.py, in particolare dall’inizializzazione delle shape e dai passaggi di reshape collegati nell’issue, e segui come vengono mantenute le dimensioni spaziali tra una chiamata e l’altra. Aggiungi un test di regressione che usi un’unica istanza di GroupNorm con due risoluzioni di input; verifica che entrambe le uscite corrispondano alle forme dei rispettivi input, poi esegui i test GroupNorm pertinenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reusing snt.GroupNorm(groups=2) on a larger image silently changes the batch size from 1 to 4. Only the height and width change between calls. The input rank, channel count, and batch size stay the same, and all optional arguments use their defaults.
Reproduction
import sonnet as snt
import tensorflow as tf
with tf.device("/CPU:0"):
norm = snt.GroupNorm(groups=2)
for size in (32, 64):
x = tf.zeros([1, size, size, 4])
y = norm(x)
print(x.shape.as_list(), "->", y.shape.as_list())
print("Fresh instance:", snt.GroupNorm(groups=2)(x).shape.as_list())
Observed output
[1, 32, 32, 4] -> [1, 32, 32, 4]
[1, 64, 64, 4] -> [4, 32, 32, 4]
Fresh instance: [1, 64, 64, 4]
Expected behavior
The second call should return [1, 64, 64, 4], just as the fresh instance does. GroupNorm.__call__ documents that the output has the same shape as the input. [API contract](https://github.com/google-deepmind/sonnet/blob/1c3b3e4dad22de663e992107531d2966fd7904aa/sonnet/src/group_norm.py#L150-L151)
Why the batch size changes
The first call caches [-1, 32, 32, 2, 2] as the grouped shape and [-1, 32, 32, 4] as the output shape. On the second call, TensorFlow infers 4 for the leading -1. GroupNorm therefore computes the normalization statistics separately for four pieces of the same image before returning them as four batch entries. [Shape initialization](https://github.com/google-deepmind/sonnet/blob/1c3b3e4dad22de663e992107531d2966fd7904aa/sonnet/src/group_norm.py#L220-L230) · [Reshape and normalization](https://github.com/google-deepmind/sonnet/blob/1c3b3e4dad22de663e992107531d2966fd7904aa/sonnet/src/group_norm.py#L172-L182)
Tested environment
dm-sonnet==2.0.2, tensorflow==2.15.1, Python 3.10.20, Windows build 26200, CPU, eager execution.
- Lingua principale
- Python
- Stelle
- 10k
- Fork
- 1.3k
- Merge medio
- 50m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di google-deepmind/sonnet
-
Laplace smoothing for EMA codebook updateForse di nuovo libera @ayushdebnath012 l’ha presa 428 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
google-deepmind/sonnet#272 · 1 commento · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
google-deepmind/sonnet#271 · 10 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
google-deepmind/sonnet#265 ·
-
Issues using SonnetAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
google-deepmind/sonnet#261 · 3 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
google-deepmind/sonnet#257 · 2 commenti ·
Tutte le issue di google-deepmind/sonnet
Issue simili
-
needs-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
flashinfer-ai/flashinfer#9803 ·
I maintainer di solito rispondono entro 1 giorno
-
bug frontend good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
oscarbol09/thesisforge#61 ·
-
api bug performance
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
oscarbol09/audiobard#159 ·
-
area:web p2 product:business triage:active type:bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
cuadrao-ai/argus#2328 ·
I maintainer di solito rispondono entro 1 giorno
-
bug frontend good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
nikhilb2/simple_invoicing#907 ·