評價此頁

Event#

class torch.mps.event.Event(enable_timing=False)[原始碼]#

MPS 事件的包裝器。

MPS 事件是同步標記,可用於監控裝置進度、精確測量時間和同步 MPS 流。

引數

enable_timing (bool, optional) – 指示事件是否應測量時間(預設值:False

elapsed_time(end_event)[原始碼]#

返回事件記錄和 end_event 記錄之間經過的時間(以毫秒為單位)。

返回型別

浮點數

query()[原始碼]#

如果事件當前捕獲的所有工作都已完成,則返回 True。

返回型別

布林值

record()[原始碼]#

在預設流中記錄事件。

synchronize()[原始碼]#

Waits until the completion of all work currently captured in this event. This prevents the CPU thread from proceeding until the event completes.

wait()[原始碼]#

使提交到預設流的所有後續工作都等待此事件。