Repository: pytorch
Issue: Tracker: ModuleInfo-based testing
Labels: module: nn,module: tests,triaged,tracker

This issue tracks the progress of updating module testing from the old `ModuleTest` / `NewModuleTest` / `CriterionTest` structure to a more understandable `ModuleInfo` based framework modeled after `OpInfo`.

- [X] Design `ModuleInfo` structure (#61935)
- [ ] Port module test coverage to use `ModuleInfo`
  - [x] Test module forward with inputs compared to reference functions (#61935)
  - [x] Test module backward pass with gradcheck / gradgradcheck (#64444)
  - [x] Test with non-contiguous inputs (#64954)
  - [x] Test across devices / dtypes (#61935)
  - [x] Test module instantiation with device / dtype kwargs (#62340)
  - [x] Test module printing (i.e. `str(m)` / `m.__repr__()`) (#63737)
  - [x] Test module pickling / unpickling (#63736)
  - [x] Test parameter casting and movement across devices (e.g. `m.cuda()`, `m.to()`, `m.half()`, etc.) (#68092)
  - [x] Test module in-place variants (i.e. `inplace=True`) vs. out-of-place variants (#63739)
  - [x] Test CPU / GPU parity (#68097)
  - [ ] Test C++ / python parity (#65807)
- [ ] Add new test coverage
  - [x] Test across memory_formats (#69317)
  - [ ] Test module documentation matches the [style guide](https://github.com/pytorch/pytorch/wiki/torch.nn-Module-Documentation-Style-Guide)
  - [ ] Test with zero batch size inputs (#65497)
- [ ] Other consumers of `ModuleTest`, etc. updated to use `ModuleInfo`
  - [ ] JIT tests use `ModuleInfo`
  - [ ] FX tests use `ModuleInfo`
  - [ ] ONNX tests use `ModuleInfo`
- [ ] Full coverage for `ModuleInfo` entries across `torch.nn` modules
  - [ ] nn.AdaptiveAvgPool1d
  - [x] nn.AdaptiveAvgPool2d
  - [ ] nn.AdaptiveAvgPool3d
  - [ ] nn.AdaptiveLogSoftmaxWithLoss
  - [ ] nn.AdaptiveMaxPool1d
  - [ ] nn.AdaptiveMaxPool2d
  - [ ] nn.AdaptiveMaxPool3d
  - [ ] nn.AlphaDropout
  - [X] nn.AvgPool1d
  - [ ] nn.AvgPool2d
  - [ ] nn.AvgPool3d
  - [ ] nn.BCELoss
  - [ ] nn.BCEWithLogitsLoss
  - [ ] nn.BatchNorm1d
  - [x] nn.BatchNorm2d
  - [x] nn.BatchNorm3d
  - [x] nn.Bilinear
  - [ ] nn.CELU
  - [ ] nn.CTCLoss
  - [ ] nn.ChannelShuffle
  - [x] nn.ConstantPad1d
  - [x] nn.ConstantPad2d
  - [x] nn.ConstantPad3d
  - [x] nn.Conv1d
  - [x] nn.Conv2d
  - [x] nn.Conv3d
  - [x] nn.ConvTranspose1d
  - [x] nn.ConvTranspose2d
  - [x] nn.ConvTranspose3d
  - [ ] nn.CosineEmbeddingLoss
  - [ ] nn.CosineSimilarity
  - [x] nn.CrossEntropyLoss
  - [ ] nn.CrossMapLRN2d
  - [ ] nn.Dropout
  - [ ] nn.Dropout2d
  - [ ] nn.Dropout3d
  - [X] nn.ELU
  - [X] nn.Embedding
  - [ ] nn.EmbeddingBag
  - [ ] nn.FeatureAlphaDropout
  - [ ] nn.Flatten
  - [ ] nn.Fold
  - [ ] nn.FractionalMaxPool2d
  - [ ] nn.FractionalMaxPool3d
  - [ ] nn.GELU
  - [ ] nn.GLU
  - [x] nn.GRU
  - [x] nn.GRUCell
  - [x] nn.GaussianNLLLoss
  - [ ] nn.GroupNorm
  - [ ] nn.Hardshrink
  - [ ] nn.Hardsigmoid
  - [X] nn.Hardswish
  - [ ] nn.Hardtanh
  - [ ] nn.HingeEmbeddingLoss
  - [ ] nn.HuberLoss
  - [ ] nn.Identity
  - [ ] nn.InstanceNorm1d
  - [ ] nn.InstanceNorm2d
  - [ ] nn.InstanceNorm3d
  - [ ] nn.KLDivLoss
  - [X] nn.L1Loss
  - [ ] nn.LPPool1d
  - [ ] nn.LPPool2d
  - [x] nn.LSTM
  - [x] nn.LSTMCell
  - [ ] nn.LayerNorm
  - [ ] nn.LazyBatchNorm1d
  - [ ] nn.LazyBatchNorm2d
  - [ ] nn.LazyBatchNorm3d
  - [x] nn.LazyConv1d
  - [x] nn.LazyConv2d
  - [x] nn.LazyConv3d
  - [x] nn.LazyConvTranspose1d
  - [x] nn.LazyConvTranspose2d
  - [x] nn.LazyConvTranspose3d
  - [ ] nn.LazyInstanceNorm1d
  - [ ] nn.LazyInstanceNorm2d
  - [ ] nn.LazyInstanceNorm3d
  - [ ] nn.LazyLinear
  - [ ] nn.LeakyReLU
  - [X] nn.Linear
  - [ ] nn.LocalResponseNorm
  - [ ] nn.LogSigmoid
  - [ ] nn.LogSoftmax
  - [ ] nn.MSELoss
  - [ ] nn.MarginRankingLoss
  - [ ] nn.MaxPool1d
  - [x] nn.MaxPool2d
  - [ ] nn.MaxPool3d
  - [ ] nn.MaxUnpool1d
  - [ ] nn.MaxUnpool2d
  - [ ] nn.MaxUnpool3d
  - [ ] nn.Mish
  - [ ] nn.ModuleDict
  - [ ] nn.ModuleList
  - [ ] nn.MultiLabelMarginLoss
  - [ ] nn.MultiLabelSoftMarginLoss
  - [ ] nn.MultiMarginLoss
  - [x] nn.MultiheadAttention
  - [X] nn.NLLLoss
  - [ ] nn.PReLU
  - [ ] nn.PairwiseDistance
  - [ ] nn.ParameterDict
  - [ ] nn.ParameterList
  - [ ] nn.PixelShuffle
  - [ ] nn.PixelUnshuffle
  - [ ] nn.PoissonNLLLoss
  - [x] nn.RNN
  - [ ] nn.RNNBase
  - [x] nn.RNNCell
  - [ ] nn.RNNCellBase
  - [ ] nn.RReLU
  - [X] nn.ReLU
  - [ ] nn.ReLU6
  - [ ] nn.ReflectionPad1d
  - [ ] nn.ReflectionPad2d
  - [ ] nn.ReflectionPad3d
  - [ ] nn.ReplicationPad1d
  - [ ] nn.ReplicationPad2d
  - [ ] nn.ReplicationPad3d
  - [ ] nn.SELU
  - [ ] nn.Sequential
  - [ ] nn.SiLU
  - [x] nn.Sigmoid
  - [ ] nn.SmoothL1Loss
  - [ ] nn.SoftMarginLoss
  - [ ] nn.Softmax
  - [ ] nn.Softmax2d
  - [ ] nn.Softmin
  - [ ] nn.Softplus
  - [ ] nn.Softshrink
  - [ ] nn.Softsign
  - [ ] nn.SyncBatchNorm
  - [ ] nn.Tanh
  - [ ] nn.Tanhshrink
  - [ ] nn.Threshold
  - [x] nn.Transformer
  - [ ] nn.TransformerDecoder
  - [x] nn.TransformerDecoderLayer
  - [x] nn.TransformerEncoder
  - [X] nn.TransformerEncoderLayer
  - [ ] nn.TripletMarginLoss
  - [ ] nn.TripletMarginWithDistanceLoss
  - [ ] nn.Unflatten
  - [ ] nn.Unfold
  - [ ] nn.Upsample
  - [ ] nn.UpsamplingBilinear2d
  - [ ] nn.UpsamplingNearest2d
  - [x] nn.ZeroPad1d
  - [x] nn.ZeroPad2d
  - [x] nn.ZeroPad3d

cc @albanD @mruberry @jbschlosser @walterddr