File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ from __future__ import annotations
16
+
15
17
import json
16
18
import warnings
19
+ from typing import TYPE_CHECKING , TypedDict
17
20
18
21
import paddle
19
22
from paddle .base import core
20
23
24
+ if TYPE_CHECKING :
25
+ from typing_extensions import NotRequired
26
+
27
+ class _Kernel (TypedDict ):
28
+ enable : bool
29
+ tuning_range : list [int ] | tuple [int , int ]
30
+
31
+ class _Layout (TypedDict ):
32
+ enable : bool
33
+
34
+ class _Dataloader (TypedDict ):
35
+ enable : bool
36
+ tuning_steps : int
37
+
38
+ class _ConfigKernel (TypedDict ):
39
+ kernel : NotRequired [_Kernel ]
40
+ layout : NotRequired [_Layout ]
41
+ dataloader : NotRequired [_Dataloader ]
42
+
43
+
21
44
__all__ = ['set_config' ]
22
45
23
46
24
- def set_config (config = None ):
47
+ def set_config (config : _ConfigKernel | str | None = None ) -> None :
25
48
r"""
26
49
Set the configuration for kernel, layout and dataloader auto-tuning.
27
50
@@ -72,7 +95,7 @@ def set_config(config=None):
72
95
... "enable": True,
73
96
... }
74
97
>>> }
75
- >>> paddle.incubate.autotune.set_config(config)
98
+ >>> paddle.incubate.autotune.set_config(config) # type: ignore[arg-type]
76
99
77
100
>>> # config is the path of json file.
78
101
>>> config_json = json.dumps(config)
You can’t perform that action at this time.
0 commit comments