Delta¶
- class torchrl.modules.Delta(param: torch.Tensor, atol: float = 1e-06, rtol: float = 1e-06, batch_shape: torch.Size | Sequence[int] = None, event_shape: torch.Size | Sequence[int] = None)[source]¶
Delta 分佈。
- 引數:
param (torch.Tensor) – Delta 分佈的引數;
atol (數字, 可選) – 用於判斷張量是否匹配分佈引數的絕對容差;預設為 1e-6
rtol (數字, 可選) – 用於判斷張量是否匹配分佈引數的相對容差;預設為 1e-6
batch_shape (torch.Size, 可選) – batch 形狀;
event_shape (torch.Size, optional) – 結果的形狀。
- expand(batch_shape: Size, _instance=None)[source]¶
返回一個新的分佈例項(或填充由派生類提供的現有例項),其中批處理維度已擴充套件到 batch_shape。此方法呼叫分佈引數上的
expand。因此,這不會為擴充套件的分佈例項分配新記憶體。此外,當例項首次建立時,這也不會在 __init__.py 中重複任何引數檢查或引數廣播。- 引數:
batch_shape (torch.Size) – 所需的擴充套件大小。
_instance – 由需要覆蓋 .expand 的子類提供的新的例項。
- 返回:
批處理維度已擴充套件到 batch_size 的新的分佈例項。