Skip to content

Make it easier to accurately reflect storage/view relationships in meta/wrapper tensors #65339

@ezyang

Description

@ezyang

When writing a wrapper tensor you typically want the wrapper to "look like" the wrapped tensor as much as possible. Some things are obvious and directly accepted like _make_wrapper_subclass such as size, dtype, device, layout, requires grad. But there are some things that are not so obvious:

  • What storage() returns
  • Whether or not the tensor reports as a view()
  • What the strides are
  • What the storage offset is

It's not so easy to get these to report correctly, since you have to create a whole "phantom" universe of storages at your wrapper level to make everything look right. @bdhirsh had to do some of this in his functionalization pass. Need to make it easier for people in general to do.

cc @albanD

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions