Why does Sionna initialize Layers in build() instead of __init__()? #857
-
In both the ResidualBlock and NeuralReceiver classes from Sionna's tutorial (here ) , layers are initialized in the build() method. However, when I moved the initialization to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @1000001111, |
Beta Was this translation helpful? Give feedback.
Hi @1000001111,
Keras uses the
build()
function to defer the initialization of components until the input shapes are fully known—for example, weight matrix dimensions depend on the output of the previous layer. You’re right that in this case, the input shapes aren’t actually used, so the same logic could be implemented directly in__init__()
.