Skip to content

torch.linspace() issue with the 4095th element #4419

@sawsc

Description

@sawsc

There seems to be an issue with the 4095th element of a torch.linspace():

import torch

def test():
    length=4100
    step=2
    v=torch.linspace(0,step*(length-1),length)
    print(v[length-10:length])

if __name__ == '__main__':
    test()

Output:

 8180.0000
 8182.0000
 8184.0000
 8186.0000
 8188.0000
 8189.9995
 8192.0000
 8194.0000
 8196.0000
 8198.0000
[torch.FloatTensor of size 10]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions