mean
MeanLayer ¤
MeanLayer(
name=None,
input_dtype=None,
output_dtype=None,
mean_constant=None,
**kwargs
)
Bases: BaseLayer
Performs the mean(x, y) operation on a given input tensor. If mean_constant is not set, inputs are assumed to be a list of tensors and the mean of all the tensors is computed. If mean_constant is set, inputs must be a tensor.
Initializes the Mean layer
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Optional[str]
|
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
|
mean_constant
|
Optional[float]
|
The constant to mean against the input, defaults to |
None
|
Source code in src/kamae/tensorflow/layers/mean.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
compatible_dtypes
property
¤
compatible_dtypes
_call ¤
_call(inputs, **kwargs)
Performs the mean(x, y) operation on either an iterable of input tensors or a single input tensor and a constant.
Decorated with @allow_single_or_multiple_tensor_input to ensure that the input
is either a single tensor or an iterable of tensors. Returns this result as a
list of tensors for easier use here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Union[Tensor, Iterable[Tensor]]
|
Single tensor or iterable of tensors to perform the mean(x, y) operation on. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
The tensor resulting from the mean(x, y) operation. |
Source code in src/kamae/tensorflow/layers/mean.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
get_config ¤
get_config()
Gets the configuration of the Mean layer. Used for saving and loading from a model.
Specifically adds the mean_constant to the config dictionary.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary of the configuration of the layer. |
Source code in src/kamae/tensorflow/layers/mean.py
113 114 115 116 117 118 119 120 121 122 123 124 | |