How can I output a gradient in vector format in Op.grad instance?

Thanks for sharing this example. I will take a look and compare it to my code.