Skip to content

Fix GPU placement when calling tensor.cuda() #623

@fritzo

Description

@fritzo

Adam pointed out that when matching the .is_cuda property of a new tensor to an existing tensor, we should also take care to match the device:

old_tensor = ...
new_tensor = torch.arange(10)
if old_tensor.is_cuda:
    new_tensor = new_tensor.cuda(old_tensor.get_device())

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions