Skip to content

torch.Tensor.repeat is divergent from np.repeat #50013

@mruberry

Description

@mruberry

torch.Tensor.repeat, as its documentation notes, is divergent from np.repeat but similar to np.tile. Now that torch.tile is implemented, we can deprecate torch.repeat in favor of torch.tile by doing the following:

  • deprecate torch.Tensor.repeat in favor of torch.tile for a release
    • verify torch.tile implements the same behavior as np.tile and torch.repeat (see discussion and linked PRs)
    • audit and update internal callsites so PyTorch doesn't throw warnings by default
  • remove torch.repeat for a release (possibly requires writing an upgrade for serialized torchscript)
  • restore torch.repeat analogous to np.repeat

np.repeat is a top 50 NumPy function, and torch.Tensor.repeat (note that torch.repeat does not exist) is popular with hundreds of uses within Facebook.

cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @mruberry @rgommers @heitorschueroff

Metadata

Metadata

Assignees

No one assigned

    Labels

    high prioritymodule: deprecationmodule: numpyRelated to numpy support, and also numpy compatibility of our operatorstriagedThis 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