Skip to content

Commit

Permalink
[tracer] fix special float args (#277)
Browse files Browse the repository at this point in the history
* [converter] add aten::sign support

* [converter] remove custom Atan2

* Update tracer.py

* Update tracer.py

* Update tracer.py
  • Loading branch information
Juelianqvq authored Jan 12, 2024
1 parent 23b02a3 commit 8fed4a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tinynn/graph/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,14 @@ def _parse_args(arg):
new_arg.append('{}')
elif type(a) in (str, torch.device):
new_arg.append(_escape_arg(f"\'{a}\'"))
elif type(a) in (int, float, bool, torch.dtype):
elif type(a) in (int, bool, torch.dtype):
new_arg.append(str(a))
elif type(a) is float:
str_arg = str(a)
if str_arg in ('nan', 'inf', '-inf'):
new_arg.append(f"float('{str_arg}')")
else:
new_arg.append(str_arg)
elif a is None:
new_arg.append('None')
elif a is Ellipsis:
Expand Down

0 comments on commit 8fed4a3

Please sign in to comment.