Could Custom Ops be as nice as core ops?

The args passed in customGrad(f)(x1, x2,…) must all be tensors. This means that custom ops are less user-friendly than the core ops which all use convertToTensor to allow them to take TensorLike objects.

I think it would be much nicer if custom ops were first class like the core ops, then library extensions could feel more natural. (I also noticed that convertToTensor seems to be private, I was expecting it in tf.util. Might that be exposed as well?)



That’s a good suggestion, thank you @iislucas . I created a feature request in our repo: Allow customGrad to take tensorlike objects · Issue #6219 · tensorflow/tfjs · GitHub

1 Like