[Relay][Op] type_relations.cc:120: Check failed: t0->dtype == t1->dtype (float32 vs. float16)

Hi,
I’m trying to load fp16 onnx model.
When relay.frontend.from_onnx(onnx_model,shape_dict,dtype=‘float16’), I got an error.

subtract(1f, %96) an internal invariant was violated while typechecking your program [08:36:23] projects/tvm/src/relay/op/type_relations.cc:120: Check failed: t0->dtype == t1->dtype (float32 vs. float16) :
; an internal invariant was violated while typechecking your program [08:36:23] projects/tvm/src/relay/op/type_relations.cc:120: Check failed: t0->dtype == t1->dtype (float32 vs. float16) :

Does anyone know how to solve it?

1 Like

I have the same problem. Is it solved now?

Sorry, not yet. :joy:
If I try to modify fp32 to fp16, I think there will be lots of work to do.

I got the same problem. The Subtract appear in ELU. My model was converted to fp16. However the result after the Exp operation in ELU is fp32.