Skip to content

torch.histogramdd Inconsistent/Incorrect Documentation #124435

@daohanlu

Description

@daohanlu

📚 The doc issue

The doc for torch.histogramdd says that "every bin is exclusive of its left edge. Only the rightmost bin is inclusive of its right edge." However, running some code suggests that every bin is inclusive of its left edge.

-> torch.histogramdd(torch.tensor([[0.0, 0.0], [0.5, 0.5], [1.0, 1.0]]), range=(0, 1.0, 0, 1.0), bins=2)
torch.return_types.histogramdd(
hist=tensor([[1., 0.],
        [0., 2.]]),
bin_edges=(tensor([0.0000, 0.5000, 1.0000]), tensor([0.0000, 0.5000, 1.0000])))

That is, [0,0] gets sent to the [0,0]th bin and both [0.5, 0.5] and [1.0, 1.0] get sent to the [1,1]th bin.

Additionally, I believe what the documentation says is not logically sound. If "every bin is exclusive of its left edge" and all but the rightmost bin is exclusive of its right edge, then there'd be holes in between the bins.

Suggest a potential alternative/fix

Change the documentation to instead say "every bin is inclusive of its left edge."

cc @svekars @brycebortree @albanD

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionablemodule: docsRelated to our documentation, both in docs/ and docblocksmodule: python frontendFor issues relating to PyTorch's Python frontendtriagedThis 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