Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

torch.add(tensor1, scalar, tensor2) not supported. #155

Open
rtqichen opened this issue Oct 1, 2016 · 1 comment
Open

torch.add(tensor1, scalar, tensor2) not supported. #155

rtqichen opened this issue Oct 1, 2016 · 1 comment

Comments

@rtqichen
Copy link

rtqichen commented Oct 1, 2016

Example code:

autograd = require 'autograd'
f = function(x)
    return torch.add(x, -2, x)
end
df = autograd(f, {withForward = false, partialGrad = true})
x = torch.randn(3)
df(x, torch.ones(3))

The last line throws an error
.../DirectTape.lua:165: missing gradient for argument 3 in function torch.add.

Not a big deal, as this use of torch.add can be decomposed into a mul followed by an add. Just thought I'd mention it.

@alexbw
Copy link
Collaborator

alexbw commented Oct 2, 2016

Thanks for the heads up. We tried to stay away from the more "exotic" call-signatures in torch, but I think there's no reason we couldn't accept a PR implementing this gradient.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants