快捷方式

事件

模块包含与标准 python 日志记录集成的事件处理机制。

使用示例

from torch.distributed.elastic import events
event = events.Event(name="test_event", source=events.EventSource.WORKER, metadata={...})
events.get_logging_handler(destination="console").info(event)

API 方法

torch.distributed.elastic.events.record(event, destination='null')[source]
torch.distributed.elastic.events.get_logging_handler(destination='null')[source]
返回类型

处理程序

事件对象

class torch.distributed.elastic.events.api.Event(name, source, timestamp=0, metadata=<factory>)[source]

该类表示在 torchelastic 作业执行期间发生的通用事件。

事件可以是任何有意义的操作。

参数
  • name (str) – 事件名称。

  • source (EventSource) – 事件生成器,例如代理或工作进程

  • timestamp (int) – 事件发生时的毫秒级时间戳。

  • metadata (Dict[str, Optional[Union[str, int, float, bool]]]) – 与事件关联的附加数据。

class torch.distributed.elastic.events.api.EventSource(value)[source]

事件生成器的已知标识符。

torch.distributed.elastic.events.api.EventMetadataValue

的别名 Optional[Union[str, int, float, bool]]

文档

访问 PyTorch 的全面的开发者文档

查看文档

教程

获取针对初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题的解答

查看资源