Skip to content

Question about LayerNorm in VectorizedLinearLayer #2

Open
@ZiyiLiubird

Description

@ZiyiLiubird

You implement LayerNorm in VectorizedLinearLayer but the LayerNorm input is "self._out_features, self._population_size", which means that the eps in LayerNorm is self._population_size. Could you please explain why ?

        self._layer_norm = (
            torch.nn.LayerNorm(self._out_features, self._population_size)
            if use_layer_norm
            else None
        )

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        assert x.shape[0] == self._population_size
        if self._layer_norm is not None:
            return self._layer_norm(x.matmul(self.weight) + self.bias)
        return x.matmul(self.weight) + self.bias

Metadata

Metadata

Assignees

No one assigned

    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