FiLM2d¶
-
class
torchelie.nn.
FiLM2d
(channels: int, cond_channels: int)¶ Feature-wise Linear Modulation from https://distill.pub/2018/feature-wise-transformations/ The difference with AdaIN is that FiLM does not uses the input’s mean and std in its calculations
- Parameters
channels (int) – number of input channels
cond_channels (int) – number of conditioning channels from which bias and scale will be derived
-
condition
(z: torch.Tensor) → None¶ Conditions the layer before the forward pass if z will not be present when calling forward
- Parameters
z (2D tensor, optional) – conditioning vector
-
forward
(x, z: Optional[torch.Tensor] = None) → torch.Tensor¶ Forward pass
- Parameters
x (4D tensor) – input tensor
z (2D tensor, optional) – conditioning vector. If not present,
condition(z)
must be called first
- Returns
x, conditioned
-
bias
: Optional[torch.Tensor]¶
-
weight
: Optional[torch.Tensor]¶