Skip to content

Normalization Layers

Bases: Layer

k3_node.layers.MeanSubtractionNorm Implementation of Mean Subtraction Norm layer

Parameters:

Name Type Description Default
**kwargs

Additional arguments to pass to the Layer superclass.

{}
Call Arguments

x Input tensor.

Call Returns

Output tensor of the same shape as x.

import numpy as np
from k3_node.layers import MeanSubtractionNorm
x = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32)
layer = MeanSubtractionNorm()
layer(x).numpy()
Source code in k3_node/layers/norm/mean_subtraction_norm.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class MeanSubtractionNorm(layers.Layer):
    """
    `k3_node.layers.MeanSubtractionNorm`
    Implementation of Mean Subtraction Norm layer

    Args:
        **kwargs: Additional arguments to pass to the `Layer` superclass.

    Call Arguments:
        `x` Input tensor.

    Call Returns:
        Output tensor of the same shape as `x`.
    ```python
    import numpy as np
    from k3_node.layers import MeanSubtractionNorm
    x = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32)
    layer = MeanSubtractionNorm()
    layer(x).numpy()
    ```
    """
    def __init__(self, **kwargs):
        super(MeanSubtractionNorm, self).__init__(**kwargs)

    def call(self, x):
        return x - ops.mean(x, axis=0, keepdims=True)