Edit Clip Operator #5299
-
Hi everyone, I am doing inference with an onnx model with Python APi onnxruntime-gpu with clip operator. I would like to modify its behaviour by assigning 0 to the input data that exceed the interval instead of limiting the given input within an interval. I would like to do so without modifying the internal operator structure, the only operator domain or other related paths affected. I also do not want to make changes to the onnx file, where the clip nodes are defined, I just want to change the onnx code where the clip function is compared and assigned when performing the inference. Is this possible, or must I add a custom clip operator with a new domain to onnxruntime? How can I archive this? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
(This question may be better off in the onnxruntime repo.) This feels a bit odd. It seems better to do this as a model-transformation, instead of altering the implementation of the clip operator. Eg., you can explicitly rewrite it to check if the value is outside some range and return 0, using a |
Beta Was this translation helpful? Give feedback.
(This question may be better off in the onnxruntime repo.) This feels a bit odd. It seems better to do this as a model-transformation, instead of altering the implementation of the clip operator. Eg., you can explicitly rewrite it to check if the value is outside some range and return 0, using a
Where
op. Alternatively, you can rewrite it into a custom op, and add a kernel for that in onnxruntime