Skip to content

Implement normalization methods(BatchNorm/LayerNorm/BatchRenorm) as functions in a common header file #5685

@zhouxiao-coder

Description

@zhouxiao-coder

Current Status

In the new Paddle core, we currently have a batch_norm_op which essentially is an implementation of fused spatial batch normalization method. Like most other operators, most computations are directly included in BatchNorm kernels.

Suggestion

I suggest we abstract away some normalization calculations and implement them as functions/functors in a common header file like normalization.h to better reuse existing code.

Reasons

  1. Normalization methods are evolving rapidly, new variants of BatchNorm come out from time to time, e.g. layer normalization and batch renormalization. They often share similar structures.
  2. Normalization layers are often used in deep architectures repeatedly, so it should be efficient. We may need to write a lot of fused kernels to support this.
  3. RNN units also benefit from using some normalization methods, we should support it in c++ code.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions