- 
                Notifications
    
You must be signed in to change notification settings  - Fork 19.6k
 
Closed
Closed
Copy link
Labels
type:docsNeed to modify the documentationNeed to modify the documentation
Description
Doc Issue
The doc of keras.layers.Normalization() shows its description as below:
keras/keras/src/layers/preprocessing/normalization.py
Lines 42 to 49 in 3fac66f
| mean: The mean value(s) to use during normalization. The passed value(s) | |
| will be broadcast to the shape of the kept axes above; | |
| if the value(s) cannot be broadcast, an error will be raised when | |
| this layer's `build()` method is called. | |
| variance: The variance value(s) to use during normalization. The passed | |
| value(s) will be broadcast to the shape of the kept axes above; | |
| if the value(s) cannot be broadcast, an error will be raised when | |
| this layer's `build()` method is called. | 
For the repro below, I accept that it should error, but need to be noted in the docstring:
Repro
import keras
normalizer = keras.layers.Normalization(axis=1, mean=0.5)
print(normalizer)Output
ValueError: When setting values directly, both `mean` and `variance` must be set. Received: mean=0.5 and variance=None
The error related is defined here:
keras/keras/src/layers/preprocessing/normalization.py
Lines 119 to 124 in 3fac66f
| # Set `mean` and `variance` if passed. | |
| if (mean is not None) != (variance is not None): | |
| raise ValueError( | |
| "When setting values directly, both `mean` and `variance` " | |
| f"must be set. Received: mean={mean} and variance={variance}" | |
| ) | 
Thanks a lot!
Metadata
Metadata
Assignees
Labels
type:docsNeed to modify the documentationNeed to modify the documentation