autocast.decoders.base#

class Decoder(*args, **kwargs)[source]#

Bases: Module, ABC

Base Decoder.

Parameters:
latent_channels: int#
postprocess(decoded)[source]#

Optionally transform the decoded tensor before returning.

Subclasses can override to implement post-decoding steps. Default is identity.

Parameters:

decoded (Tensor)

Return type:

Float[Tensor, ‘batch time spatial *spatial channel’]

abstract decode(z)[source]#

Decode the latent tensor back to the original space.

Parameters:

z (Float[Tensor, 'batch *optional_dims channel']) – Latent tensor to be decoded.

Returns:

Decoded tensor in the original space.

Return type:

Float[Tensor, ‘batch time spatial *spatial channel’]

forward(z)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:

z (Float[Tensor, 'batch *optional_dims channel'])

Return type:

Float[Tensor, ‘batch time spatial *spatial channel’]