Hi,
I’m trying to add an ONNX op class in onnx frontend.
I have some questions about it:
1. Every ‘_impl_v1’ has 4 params, what is the ‘inputs’ length?
2. Where does ‘attr’ come from?
3. What type should I output? Refer onnx operators’ spec?
1 Like
I’ve implemented a TopK v10 op in onnx frontend, does anyone give some suggestion?
class TopK(OnnxOpConverter):
@classmethod
def _impl_v10(cls, inputs, attrs, params):
assert len(inputs) == 2
new_attrs = {}
new_attrs["axis"] = attrs.get("axis", -1) #todo cause if we set axis > -1, the topk return shape will error, I don't know why.
new_attrs["ret_type"] = "both"
new_attrs["is_ascend"] = False
new_attrs["dtype"] = "int32"
new_attrs["k"] = params[inputs[1].name_hint].asnumpy()[0]
return _op.topk(inputs[0], **new_attrs)