Skip to content

Torchvision ops registration still not fixed in C++ #3593

Open
@bmanga

Description

@bmanga

It turns out the solution I implemented for automatic ops registration in C++ is not robust enough.
If falls apart when the actual torchvision code is enclosed in a static library, which is then meant to be consumed by an executable. This indirect hop through a library exposes the pruning problem all over again. Apologies for not realizing earlier and implementing it this way :/.

In the end, I think the only two viable solutions are the ones we discussed a while ago:

  1. Force include all symbols through linker commands (eg. --whole-archive)
  2. Add, only for the C++ API, a register_operators function that must be called in order to explicitly load the operators, and stop relying on the implicit behavior

As before my preference goes to 2 because it's simpler to implement and maintain, and it doesn't risk bloating the binary with unneeded symbols. However, option 1 is what torch already does (sadly).

Thoughts? @fmassa @datumbox

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions