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, 可选) – 批次形状;
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 的批次维度的新的分布实例。