Example

Centered Layer

A practical example of a custom parameterless layer is a centered layer, which normalizes its input by subtracting the mean of the input tensor from each of its elements. Mathematically, for an input tensor X\mathbf{X}, the forward propagation of this layer computes Xextmean(X)\mathbf{X} - ext{mean}(\mathbf{X}). This operation ensures that the output tensor always has a mean of exactly 00 (subject to minor floating-point quantization errors).

0

1

Updated 2026-05-09

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L