Add unit test for nested_tensor input to nn.TransformerEncoder (#100650)
Summary: Add unit test for nested_tensor input & fix
Test Plan: sandcastle
Differential Revision: D45580393
Pull Request resolved: https://github.com/pytorch/pytorch/pull/100650
Approved by: https://github.com/jbschlosser