standard_scale
StandardScaleLayer ¤
StandardScaleLayer(
mean,
variance,
name=None,
input_dtype=None,
output_dtype=None,
axis=-1,
mask_value=None,
**kwargs
)
Bases: NormalizeLayer
Performs the standard scaling of the input.
This layer will shift and scale inputs into a distribution centered around
0 with standard deviation 1. It accomplishes this by precomputing the mean
and variance of the data, and calling (input - mean) / sqrt(var) at
runtime. mask_value is used to ignore certain values in the standard scaling
process. They will remain the same value in the output value as they were in
the input value.
Initialise the StandardScaleLayer layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mean |
Union[List[float], array]
|
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 |
required |
variance |
Union[List[float], array]
|
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 |
required |
name |
Optional[str]
|
The name of the layer. Defaults to |
None
|
input_dtype |
Optional[str]
|
The dtype to cast the input to. Defaults to |
None
|
output_dtype |
Optional[str]
|
The dtype to cast the output to. Defaults to |
None
|
axis |
Optional[Union[int, tuple[int]]]
|
Integer, tuple of integers, or None. The axis or axes that should have a separate mean and variance for each index in the shape. For example, if shape is |
-1
|
mask_value |
Optional[float]
|
Value which should be ignored in the standard scaling process and left unchanged. |
None
|
Source code in src/kamae/keras/core/layers/standard_scale.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
get_config ¤
get_config()
Gets the configuration of the StandardScaleLayer layer. Used for saving and loading from a model. Specifically adds additional parameters to the base configuration.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary of the configuration of the layer. |
Source code in src/kamae/keras/core/layers/standard_scale.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |