Skip to content

Split up test_nn.py #63085

@jbschlosser

Description

@jbschlosser

Background

The test/test_nn.py file is a huge monolith that is too large to work with comfortably; it doesn't load fully in GitHub, syntax highlighting breaks in vim, etc. We should break it up to be more manageable.

Proposal

There's a few different ways to go about this:

  1. Split the existing test classes (e.g. TestNN, TestNNDeviceType, etc.) into separate files.
    • Easiest, most direct way to split test_nn.py into smaller files.
    • There are currently 11 different test classes, some of which have very few tests (looking at you, TestFunctionalPickle).
    • Probably not the best long-term, since it doesn't keep related tests together. For example, it's common to add tests to both TestNN and TestNNDeviceType for a new module.
  2. Split tests by module type, mirroring the structure in torch/nn/modules.
    • For example, pooling-related tests would go in test/nn/pooling.py.
    • Each would need a separate test class for device-agnostic and device-specific tests.
    • Might need some way to maintain / enforce the mirroring, although changes in torch/nn/modules don't happen too often.
    • There are lots of tests in test_nn.py that aren't module specific that still need a home.
  3. ???

Note: At any given point, there are generally several outstanding PRs touching test_nn.py. So actually accomplishing the splitting, whichever way it goes, will be lots of fun :)

cc @albanD @mruberry @jbschlosser

Metadata

Metadata

Assignees

No one assigned

    Labels

    better-engineeringRelatively self-contained tasks for better engineering contributorsmodule: nnRelated to torch.nntriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions