We need to support Clip operator from Caffe2. Spec can be found here:
https://caffe2.ai/docs/operators-catalogue.html#clip
@yzhao30 feel free to grab this one, let us know if you have any questions.
Some guidelines:
The code which parses Caffe2 proto leaves here:
https://github.com/pytorch/glow/blob/master/lib/Importer/Caffe2.cpp
When seeing an operator, this code usually calls corresponding method of the Graph (e.g. G_.createClip()). Each Graph method either creates a new node of required type. Or does "immediate lowering": creates node of another type, performing required action. See createFlatten() for example. The same needs to happen here for createClip. Clip could be represented as a combination of Compares, Selects and Splats.
Related issue is supporting ReplaceNaN (#1704 ). It is very similar operator, maybe even a bit simpler.
As a followup would be great to have a documentation on how to implement ONNX/C2 operator in Glow.
Specifically, what are the necessary steps and considerations to have to implement an Op.
@yzhao30 For testing, you could take a look at this file :
https://github.com/pytorch/glow/blob/master/tests/unittests/caffe2ImporterTest.cpp
Great work!
As a followup would be great to have a documentation on how to implement ONNX/C2 operator in Glow.
Specifically, what are the necessary steps and considerations to have to implement an Op.
@yzhao30 would you like to tackle this as well?
As a followup would be great to have a documentation on how to implement ONNX/C2 operator in Glow.
Specifically, what are the necessary steps and considerations to have to implement an Op.@yzhao30 would you like to tackle this as well?
Sure. I can. But this Clip op is just a combination of existing ones. Should we also document on other cases that involve lower layers?
@yzhao30 Yes, would be great to cover both cases. Let's connect next week to discuss that.
Thanks!
We need to implement ONNX loader for this as well. Reopening.
Most helpful comment
As a followup would be great to have a documentation on how to implement ONNX/C2 operator in Glow.
Specifically, what are the necessary steps and considerations to have to implement an Op.