Skip to content

Allow setting empty CPU or CUDA storage for a Tensor with non-zero sizes and strides #62972

@zou3519

Description

@zou3519

🚀 Feature

@ezyang tells me that's what https://github.com/facebookresearch/functorch/blob/619f392a0b1afa132b9c791c85c75538b2482788/functorch/_src/python_key.py#L28-L31 is supposed to do, but the code actually resizes the storage to having the passed-in sizes and strides.

Motivation

This saves memory. Also helps prevent #62730 from happening

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: __torch_dispatch__triagedThis 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