DDProtocol

class DDProtocol(*args, **kwargs)[source]

Bases: Protocol

Diffusion data protocol.

aggregate(reduction: str = 'mean') Tensor[source]

Reduce over all dimensions except batch (i.e., sum per sample).

Parameters:

reduction (str, default: "mean") – Specifies the reduction to apply: “mean” or “sum”.

Return type:

Tensor of shape (len(self),)

apply(op: Callable[[Tensor], Tensor]) Self[source]

Apply a function to the underlying tensor data (e.g., x -> -x).

classmethod collate(items: Sequence[Self]) Self[source]
combine(other: Self, op: Callable[[Tensor, Tensor], Tensor]) Self[source]

Combine self with another instance element-wise (e.g., x + y).

Note: other is guaranteed to be of the same type as self because the Mixin handles scalar broadcasting before calling this.