Looking through the docs,I see a lot of names I recognize from NumPy as extensions/implementations of CustomOp or DynamicCustomOp
These objects don’t have any methods that seem meant for the operations implied by the class names. In fact, I looked at “Direct Known Subclasses” of DynamicCustomOp and I see a lot of functionality that I would love to use, but don’t know how to implement.
Is there a code snippet somewhere that I’m not seeing that explains how to use these ops via SameDiff or other?
I’ve been peaking at the SameDiff docs, as well as linalg.api.ops.custom which has a lot of familiar names from Numpy but it’s not very clear how to use these objects. For example, the constructor of the Roll object looks like the method signature for np.roll:
@wcneill DynanicCustomOps are a way of accessing underlying c++ ops that may not be already mapped by us. You can see the full list of ops here:
All you need to know is DyamicCustomOps have addInput(…), addTArgs (add float argument), addIArg(…) which allow you to add arguments that you want to pass to the underlying c++ runtime following the schema above.
These signatures are generated from our code gen tool found in contrib:
I generally run this by importing in intellij. There hasn’t been a need to streamline this too much but I would like to eventually get around to tthat.
This is all generated from the c++. Generally dynamic ops allow some parameters to be passed in either via integer arguments or via ndarray arguments. This is to allow flexibility in situations where the dimensions of a computation are themselves a variable in a computation graph rather than static.