infer_shape() should be relatively easy to get to work as an optional argument.

But grad is a whole other list of problems.  I can't think of an interface that would work and make it easier than just writing an op.  Because there is not much code involved in making an op.