= torch.zeros((1, 4, 3, 4))
a = PositionalEncoding2D(d_model=4)
l
0].shape l(a)[
torch.Size([4, 3, 4])
Common model layers.
DownBlock2D (in_ch, out_ch, kernel_size=2, stride=2, padding=0, use_conv=True)
A 2d down scale block.
UpBlock2D (in_ch, out_ch, kernel_size=2, stride=2, padding=0, use_conv=True)
A 2d up scale block.
ResBlock2D (in_ch, out_ch, kernel_size, skip=True)
A 2d residual block.
ResBlock2D_Conditional (in_ch, out_ch, t_emb_size, kernel_size, skip=True)
A 2d residual block with input of a time-step \(t\) embedding.
FeedForward (in_ch, out_ch, inner_mult=1)
A small dense feed-forward network as used in transformers
.
Create sinusoidal position embeddings, same as those from the transformer
:
PositionalEncoding (d_model:int, dropout:float=0.0, max_len:int=5000)
An absolute pos encoding layer.
TimeEmbedding (d_model:int, dropout:float=0.0, max_len:int=5000)
A time embedding layer
PositionalEncodingTransposed (d_model:int, dropout:float=0.0, max_len:int=5000)
An absolute pos encoding layer.
PositionalEncoding2D (d_model:int, dropout:float=0.0, max_len:int=5000)
A 2D absolute pos encoding layer.