cutcutcodec.core.nn.model.compression.img_cgavaenn.Decoder
- class cutcutcodec.core.nn.model.compression.img_cgavaenn.Decoder[source]
Unfold the projected encoded images into the color space.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(lat: Tensor, *, mse: bool = True, gen: bool = True) Tensor[source]
Apply the function on the latent images.
Parameters
- lattorch.Tensor
The projected image in the latent space of shape (n, 256, hl, wl).
- mseboolean, default=True
If True, return the mse head result at first position, return None otherwise.
- genboolean, default=True
If True, return the generative head result at second position, return None otherwise.
Returns
- img_msetorch.Tensor or None
A close image in colorspace to the input image. It is as mutch bijective as possible than VariationalEncoder. New shape is (n, 256, 160+hl*32, 160+wl*32) with value in [0, 1].
- img_gentorch.Tensor or None
A beautifull image in colorspace, don’t match very accurately to the original. It can be extrapolated in order to reinvent details. New shape is (n, 256, 160+hl*32, 160+wl*32) with value in [0, 1].
Examples
>>> import torch >>> from cutcutcodec.core.nn.model.compression.img_cgavaenn import Decoder >>> decoder = Decoder() >>> mse, gen = decoder(torch.rand((10, 256, 1, 3))) >>> mse.shape torch.Size([10, 3, 192, 256]) >>> gen.shape torch.Size([10, 3, 192, 256]) >>>