Can't find torch._transformer_encoder_layer_fwd in Pytorch document or in Pytorch public code on github

I saw this method is called in torch.nn.modules.transformer’s code but I couldn’t find out any information about this method ::

Methods starting with an underscore are private and thus not documented. If you want to look into the forward implementation you could search for the method in the repository.

@ptrblck - for the life of me, I can’t find torch._transformer_encoder_layer_fwd in the github repository. This is all that comes back: https://github.com/search?q=repo%3Apytorch%2Fpytorch%20_transformer_encoder_layer_fwd&type=code

You can find its dispatching in aten/src/ATen/native/native_funcitons.yaml, which will then call into transformer_encoder_layer_forward.

1 Like