Skip to content

Variable.requires_grad property spread procedure behaves differently on CUDA and CPU mode #863

@splintersu

Description

@splintersu

`
import torch as th
from torch.autograd import Variable

x = Variable(th.Tensor([1 , 2 , 3]) , requires_grad = False)
y = Variable(th.Tensor([100]) , requires_grad = True)

x = x.cuda(0)
y = y.cuda(0)

x[0] = y

print(x.requires_grad)
`

If (x=x.cuda(0) y=y.cuda(0)) is executed then the output is False, True otherwise.
I think the result that x.requires_grad = True is more natural.

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