Hi Frank,
Thanks for the informative answer!
For now, this method seems to solve the speed issue - it’s blazingly fast by comparison. I would be happy using scipy, but how would I ensure the gradients are calculated correctly? Does there exist a backprop method for such things?