View source: R/layers-normalization.R
layer_unit_normalization | R Documentation |
Unit normalization layer
layer_unit_normalization(object, axis = -1L, ...)
object |
What to compose the new
|
axis |
Integer or list. 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. Defaults to |
... |
standard layer arguments. data <- as_tensor(1:6, shape = c(2, 3), dtype = "float32") normalized_data <- data %>% layer_unit_normalization() for(row in 1:2) normalized_data[row, ] %>% { sum(.^2) } %>% print() # tf.Tensor(0.9999999, shape=(), dtype=float32) # tf.Tensor(1.0, shape=(), dtype=float32) |
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
).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.