Skip to content

Commit 6044098

Browse files
authored
Merge pull request #230 from iksnagreb/fix/infer-fp32-mac
[InferDT] MAC-like node dtype output to fp32 if any fp32 operands
2 parents 7c86aee + f158494 commit 6044098

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/qonnx/transformation/infer_datatypes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def infer_mac_result_dtype(idtypes, odtype_orig, possible_negation):
5050
ret = DataType["INT32"] if maybe_signed else DataType["UINT32"]
5151
elif all([is_scaled_int(x) for x in idtypes]):
5252
ret = DataType["SCALEDINT<32>"]
53+
elif any(["FLOAT" in x.name for x in idtypes]):
54+
# default to float32 if any inps are float
55+
# TODO use output container dtype instead?
56+
ret = DataType["FLOAT32"]
5357
return ret
5458

5559

0 commit comments

Comments
 (0)