필터 지우기
필터 지우기

Why does layerNormalizationLayer in Deep Learning Toolbox include T dimension into the batch?

조회 수: 1 (최근 30일)
Hello,
While implementing a ViT transformer in Matlab, I found at that the layerNormalizationLayer does include the T dimension in the statistics calculated for each sample in the batch. This is problematics when implementing a transformer, since tokens correspond to the T dimension and reference implementations calculate the statistics separately for each token.
Thx

채택된 답변

John Smith
John Smith 2023년 3월 24일
It seems Mathworks have listened and changed the behavior of layerNormalizationLayer in R2023a.:
Starting in R2023a, by default, the layer normalizes sequence data over the channel and spatial dimensions. In previous versions, the software normalizes over all dimensions except for the batch dimension (the spatial, time, and channel dimensions). Normalization over the channel and spatial dimensions is usually better suited for this type of data. To reproduce the previous behavior, set OperationDimension to "batch-excluded".

추가 답변 (1개)

Matt J
Matt J 2023년 3월 13일
Perhaps you can fold your T dimension into the C dimension and use a groupNormalizationLayer instead, with the groups defined so that different T belong to different groups.
  댓글 수: 7
John Smith
John Smith 2023년 3월 15일
Perhaps lamenting would cause someone from Mathworks to take notice and add the capability to the code base. Sigh ...
Matt J
Matt J 2023년 3월 15일
That happens sometimes, but usually you have to submit a formal enhancement request.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Build Deep Neural Networks에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by