2024-07-21 18:43:11 -07:00
|
|
|
import torch
|
|
|
|
|
|
|
|
|
|
from .interface import Platform, PlatformEnum
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TpuPlatform(Platform):
|
|
|
|
|
_enum = PlatformEnum.TPU
|
|
|
|
|
|
2024-09-18 18:38:11 +08:00
|
|
|
@classmethod
|
|
|
|
|
def get_device_name(cls, device_id: int = 0) -> str:
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
2024-09-29 10:50:51 +08:00
|
|
|
@classmethod
|
|
|
|
|
def get_device_total_memory(cls, device_id: int = 0) -> int:
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
2024-09-18 18:38:11 +08:00
|
|
|
@classmethod
|
|
|
|
|
def inference_mode(cls):
|
2024-07-21 18:43:11 -07:00
|
|
|
return torch.no_grad()
|