Skip to content

Commit 284afde

Browse files
authored
tensorflow: Add some functions from the config module (#11325)
1 parent faf9d77 commit 284afde

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from _typeshed import Incomplete
2+
from typing import NamedTuple
3+
4+
from tensorflow.config import experimental as experimental
5+
6+
class PhysicalDevice(NamedTuple):
7+
name: str
8+
device_type: str
9+
10+
def list_physical_devices(device_type: None | str = None) -> list[PhysicalDevice]: ...
11+
def get_visible_devices(device_type: None | str = None) -> list[PhysicalDevice]: ...
12+
def set_visible_devices(devices: list[PhysicalDevice] | PhysicalDevice, device_type: None | str = None) -> None: ...
13+
def __getattr__(name: str) -> Incomplete: ...
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import typing_extensions
2+
from _typeshed import Incomplete
3+
from typing import TypedDict
4+
5+
from tensorflow.config import PhysicalDevice
6+
7+
class _MemoryInfo(TypedDict):
8+
current: int
9+
peak: int
10+
11+
def get_memory_info(device: str) -> _MemoryInfo: ...
12+
def reset_memory_stats(device: str) -> None: ...
13+
@typing_extensions.deprecated("This function is deprecated in favor of tf.config.experimental.get_memory_info")
14+
def get_memory_usage(device: PhysicalDevice) -> int: ...
15+
def get_memory_growth(device: PhysicalDevice) -> bool: ...
16+
def set_memory_growth(device: PhysicalDevice, enable: bool) -> None: ...
17+
def __getattr__(name: str) -> Incomplete: ...

0 commit comments

Comments
 (0)