diff --git a/bayesflow/networks/mlp/hidden_block.py b/bayesflow/networks/mlp/hidden_block.py index b16dbeff8..c35598953 100644 --- a/bayesflow/networks/mlp/hidden_block.py +++ b/bayesflow/networks/mlp/hidden_block.py @@ -51,7 +51,7 @@ def call(self, inputs: Tensor, training: bool = False, **kwargs) -> Tensor: def build(self, input_shape): self.dense.build(input_shape) - if input_shape[-1] != self.units: + if input_shape[-1] != self.units and self.residual: self.projector = self.add_weight( shape=(input_shape[-1], self.units), initializer="glorot_uniform", trainable=True, name="projector" )