cybertronai / autograd-hacks

The Unlicense
151 stars 31 forks source link

RuntimeError: grad can be implicitly created only for scalar outputs #7

Closed slerman12 closed 3 years ago

slerman12 commented 3 years ago

My model outputs a vector, but I actually only need the grad for one scalar in that vector. Is there a way I can get this to work?

slerman12 commented 3 years ago

To clarify, I'm trying to get per-example grads. I have a model that outputs a vector, so this library isn't compatible with it by default, but I actually only need the grads with respect to one dimension (scalar) in that vector.