Skip to content

torch.empty_like example seems wrong #52375

@guilhermeleobas

Description

@guilhermeleobas

📚 Documentation

The example presented for torch.empty_like seems wrong:

>>> torch.empty((2,3), dtype=torch.int64)
tensor([[ 9.4064e+13,  2.8000e+01,  9.3493e+13],
        [ 7.5751e+18,  7.1428e+18,  7.5955e+18]])

I guess the desided example would be something like:

>>> a = torch.empty((2,3), dtype=torch.int64)
>>> torch.empty_like(a, dtype=torch.float64)
tensor([[ 9.4064e+13,  2.8000e+01,  9.3493e+13],
        [ 7.5751e+18,  7.1428e+18,  7.5955e+18]])

cc @brianjo @mruberry @gchanan

Metadata

Metadata

Assignees

Labels

module: docsRelated to our documentation, both in docs/ and docblocksmodule: tensor creationtriagedThis 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