Skip to content

Commit 31a04c3

Browse files
committed
Add some functions from the config module.
1 parent d3b45a4 commit 31a04c3

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from typing import NamedTuple
2+
3+
from tensorflow.config import experimental as experimental
4+
5+
class PhysicalDevice(NamedTuple):
6+
name: str
7+
device_type: str
8+
9+
def list_physical_devices(device_type: None | str = None) -> list[PhysicalDevice]: ...
10+
def get_visible_devices(device_type: None | str = None) -> list[PhysicalDevice]: ...
11+
def set_visible_devices(devices: list[PhysicalDevice], device_type: None | str = None) -> None: ...
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from typing_extensions import TypedDict
2+
3+
from tensorflow.config import PhysicalDevice
4+
5+
class _MemoryInfo(TypedDict):
6+
current: int
7+
peak: int
8+
9+
def get_memory_info(device: str) -> _MemoryInfo: ...
10+
def reset_memory_stats(device: str) -> None: ...
11+
def get_memory_usage(device: PhysicalDevice) -> bytes: ...
12+
def get_memory_growth(device: PhysicalDevice) -> bool: ...
13+
def set_memory_growth(device: PhysicalDevice, enable: bool) -> None: ...

0 commit comments

Comments
 (0)