Fix substitution order in parse_type_str (#316)
* Fix substitution order in parse_type_str Signed-off-by: Ganesan Ramalingam <grama@microsoft.com> * add comment * Remove files added accidentally Co-authored-by: chentong319 <chentong@us.ibm.com> Co-authored-by: Tian Jin <tjingrant@gmail.com>
This commit is contained in:
parent
46306a8a26
commit
75930ffbcf
|
@ -818,7 +818,11 @@ def parse_type_str(allowedType):
|
||||||
'complex128' : 'Complex<F64>',
|
'complex128' : 'Complex<F64>',
|
||||||
'string' : 'StringType'}
|
'string' : 'StringType'}
|
||||||
|
|
||||||
for key, item in onnx_to_mlir_type_dict.items():
|
# Apply substitutions in decreasing order of key-length, so that float16 is replaced
|
||||||
|
# before float, and uint16 is replaced before int16, etc.
|
||||||
|
mapping = list(onnx_to_mlir_type_dict.items())
|
||||||
|
mapping.sort(key=lambda pair:len(pair[0]), reverse=True)
|
||||||
|
for key, item in mapping:
|
||||||
allowedType = allowedType.replace(key, item)
|
allowedType = allowedType.replace(key, item)
|
||||||
return allowedType
|
return allowedType
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue