Skip to content

Make WeightsEnum public #7094

@adamjstewart

Description

@adamjstewart

🚀 The feature

I propose making torchvision.models._api.WeightsEnum public and adding documentation for it.

Motivation, pitch

TorchGeo is adopting torchvision's new multi-weight support API: torchgeo/torchgeo#917

All of our weights subclass WeightsEnum, but this requires us to import directly from torchvision.models._api. Since this module is prefixed by an underscore, I'm assuming this class is private and subject to change. Also, since this class isn't documented, we have to silence Sphinx warnings about the missing parent class docs.

Alternatives

We could copy-n-paste your WeightsEnum implementation but code duplication is bad and I don't want to deal with legal. We could keep importing from a private module but it may change in the future. Are there any other suggested alternatives for other libraries trying to copy the same design? Maybe this could be moved into TorchData?

Additional context

@nilsleh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions