Skip to content

Assign torch.Generator in APIs like torch.randn_like() #128786

@KarhouTam

Description

@KarhouTam

🚀 The feature, motivation and pitch

It is possible to add generator argument in APIs like torch.randn_like()?
Because torch.randn() has argument generator and at the same time, in my opinion, torch.randn_like(A, generator=rng_torch) should output the same result as torch.randn(A.shape, generator=rng_torch).

Alternatives

No response

Additional context

No response

cc @pbelevich @albanD

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionablemodule: python frontendFor issues relating to PyTorch's Python frontendmodule: randomRelated to random number generation in PyTorch (rng generator)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