tf.keras.layers.UnitNormalization

Unit normalization layer.

Inherits From: Layer, Operation

Normalize a batch of inputs so that each input in the batch has a L2 norm equal to 1 (across the axes specified in axis).

Example:

data = np.arange(6).reshape(2, 3)
normalized_data = keras.layers.UnitNormalization()(data)
print(np.sum(normalized_data[0, :] ** 2)
1.0

axis Integer or list/tuple. The axis or axes to normalize across. Typically, this is the features axis or axes. The left-out axes are typically the batch axis or axes. -1 is the last dimension in the input. Defaults to -1.

input Retrieves the input tensor(s) of a symbolic operation.

Only returns the tensor(s) corresponding to the first time the operation was called.

output Retrieves the output tensor(s) of a layer.

Only returns the tensor(s) corresponding to the first time the operation was called.

Methods

from_config

View source

Creates a layer from its config.

This method is the reverse of get_config, capable of instantiating the same layer from the config dictionary. It does not handle layer connectivity (handled by Network), nor weights (handled by set_weights).

Args
config A Python dictionary, typically the output of get_config.

Returns
A layer instance.

symbolic_call

View source