I'm trying to get my head around differentiable programming, but in a specific way.
My application (for pedagogical purposes only) is to take a cannon that can fire with three parameters: angle (of turn relative to the ground), elevation angle (of the barrel) and firing velocity. I want to know where the cannon ball lands in (x,y) co-ordinates relative to the cannon. Obviously one can use Newton's equations to build large sets of ground truth data.
I've build a working system that, given the parameters, returns the landing location of the ball.
What I want to build is a system that, given a landing location, produces the cannon parameters. It's a minimal version of inverse kinematics. This requires a loss function for the parameters which you can't do sensibly, so I want to use my Newtonian function (written in Python), to calculate the landing spot exactly for the predicted value and for the target value and use the difference as the loss.
This isn't working well. The return type from the forward function in the loss class is opaque to me and it's not clear it if has to somehow retain and/or build on autodiff's computation graph. I thought the loss function could just return a bunch of numbers and have autodiff sort it out but maybe I have to build the whole calculation in torch? Eugh.
Any PyTorch experts in the house? Loss functions in Python.
Re: Any PyTorch experts in the house? Loss functions in Pyth
So having slept on it...
Of course the loss function needs to be differentiable (that's what's autodiff is going to use to descend the gradient), and it has to be automatically differentiable, which means it has to be derived from the prediction using only the known-reversible operations defined by torch. So, yes I do need to build the computation graph.
I want a DSL for this.
Of course the loss function needs to be differentiable (that's what's autodiff is going to use to descend the gradient), and it has to be automatically differentiable, which means it has to be derived from the prediction using only the known-reversible operations defined by torch. So, yes I do need to build the computation graph.
I want a DSL for this.
