Skip to content

Fix the Doc of the combination relation in func keras.layers.Normalization() #21715

@ILCSFNO

Description

@ILCSFNO

Doc Issue

The doc of keras.layers.Normalization() shows its description as below:

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:

# 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

Labels

type:docsNeed to modify the documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions