probly.representation.ddu.torch.TorchDDURepresentation¶
- class probly.representation.ddu.torch.TorchDDURepresentation(softmax: TorchCategoricalDistribution = <property object>, densities: torch.Tensor = <property object>)[source]¶
Bases:
DDURepresentation,TorchAxisProtectedDDU representation backed by torch tensors.
- Parameters:
softmax – Softmax probabilities over classes, shape (batch, num_classes).
features – Feature vectors from the penultimate layer, shape (batch, feature_dim).
- clone(*, memory_format: memory_format = torch.preserve_format) Self[source]¶
Return a copy of the array.
- cpu(memory_format: memory_format = torch.preserve_format) Self[source]¶
Move the array to the CPU.
- cuda(device: device | str | None = None, non_blocking: bool = False, memory_format: memory_format = torch.preserve_format) Self[source]¶
Move the array to the GPU.
- densities: torch.Tensor¶
- permitted_functions = {}¶
- permute(*dims: Size | int | tuple[int] | list[int]) Self[source]¶
Return a permuted version of the array.
- protected_values(func: Callable | None = None) dict[str, TorchProtectedValue] | None[source]¶
Return all protected field values as-is.
Optionally takes the torch function that triggered the call for context. This can be used to conditionally modify the returned values or prevent them from being accessed.
- size(dim: int | None = None) int | Size[source]¶
Return the size of the array along the given dimension.
- softmax: TorchCategoricalDistribution¶
- to_device(device: Literal['cpu'], /, *, stream: int | Any | None = None) Self[source]¶
Move the array to a device.