PixelCNN

class torchelie.models.PixelCNN(hid: int, sz: Tuple[int, int], channels: int = 3, n_layer: int = 3)

A PixelCNN model with 6 blocks

Parameters
  • hid (int) – the number of hidden channels in the blocks

  • sz ((int, int)) – the size of the images to learn. Must be square

  • channels (int) – number of channels in the data. 3 for RGB images

forward(x: torch.Tensor)torch.Tensor

A forward pass for training

partial_sample(x: torch.Tensor, temp: float)torch.Tensor
sample(temp: float, N: int)torch.Tensor

Sample a batch of images

Parameters
  • temp (float) – the sampling temperature

  • N (int) – number of images to generate in the batch

Returns

A batch of images

sample_(img: torch.Tensor, temp: float = 0, start_coord: Tuple[int, int] = (0, 0))torch.Tensor
sample_cond(cond: torch.Tensor, temp: float)torch.Tensor
training: bool