Skip to content

Commit 8808181

Browse files
committed
Update
1 parent 4cdf11a commit 8808181

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
def get_precision(t, dtype):
2-
if "float16" in dtype:
3-
return 10 ** (t * 3 / 5), 10**t
4-
elif "bfloat16" in dtype:
5-
return 10 ** (t * 1.796 / 5), 10**t
6-
elif "float32" in dtype:
7-
return 10 ** (t * 5.886 / 5), 10**t
8-
elif "float64" in dtype:
9-
return 10 ** (t * 7 / 5), 10 ** (t * 7 / 5)
10-
else:
11-
return 0, 0
2+
dtype_map = {
3+
"float16": (3 / 5, 1),
4+
"bfloat16": (1.796 / 5, 1),
5+
"float32": (5.886 / 5, 1),
6+
"float64": (7 / 5, 7 / 5),
7+
}
8+
9+
for key, (exp1, exp2) in dtype_map.items():
10+
if dtype == key:
11+
return 10 ** (t * exp1), 10 ** (t * exp2)
12+
13+
return 0, 0
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)