File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Copyright (c) 2024 Graphcore Ltd. All rights reserved.
2
2
3
+ from types import ModuleType
3
4
import numpy as np
5
+ from .types import FormatInfo
4
6
5
- from .types import FloatClass , FloatValue , FormatInfo
6
7
7
-
8
- def decode_ndarray (fi : FormatInfo , codes : np .ndarray , np = np ) -> np .ndarray :
8
+ def decode_ndarray (
9
+ fi : FormatInfo , codes : np .ndarray , np : ModuleType = np
10
+ ) -> np .ndarray :
9
11
r"""
10
12
Vectorized version of :function:`decode_float`
11
13
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def dec(code: int) -> float:
34
34
35
35
36
36
@pytest .mark .parametrize ("method" , methods )
37
- def test_spot_check_ocp_e5m2 (method ) -> None :
37
+ def test_spot_check_ocp_e5m2 (method : str ) -> None :
38
38
fi = format_info_ocp_e5m2
39
39
dec = get_method (method , fi )
40
40
fclass = lambda code : decode_float (fi , code ).fclass
@@ -51,7 +51,7 @@ def test_spot_check_ocp_e5m2(method) -> None:
51
51
52
52
53
53
@pytest .mark .parametrize ("method" , methods )
54
- def test_spot_check_ocp_e4m3 (method ) -> None :
54
+ def test_spot_check_ocp_e4m3 (method : str ) -> None :
55
55
fi = format_info_ocp_e4m3
56
56
dec = get_method (method , fi )
57
57
assert dec (0x40 ) == 2.0
You can’t perform that action at this time.
0 commit comments