Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about LayerNorm in VectorizedLinearLayer #2

Open
ZiyiLiubird opened this issue Nov 2, 2022 · 0 comments
Open

Question about LayerNorm in VectorizedLinearLayer #2

ZiyiLiubird opened this issue Nov 2, 2022 · 0 comments

Comments

@ZiyiLiubird
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant