快捷方式

ClearCudaCache

class torchrl.trainers.ClearCudaCache(interval: int)[source]

以給定間隔清除 cuda 快取。

示例

>>> clear_cuda = ClearCudaCache(100)
>>> trainer.register_op("pre_optim_steps", clear_cuda)
abstract register(trainer: Trainer, name: str)

Registers the hook in the trainer at a default location.

引數:
  • trainer (Trainer) – the trainer where the hook must be registered.

  • name (str) – the name of the hook.

注意

To register the hook at another location than the default, use register_op().

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

為初學者和高階開發者提供深入的教程

檢視教程

資源

查詢開發資源並讓您的問題得到解答

檢視資源