class_docstr: ## ResNet Block
docstr: :param channels: the number of input channels
  :param d_t_emb: the size of timestep embeddings
  :param out_channels: is the number of out channels. defaults to `channels.
docstr_tok: [":","param","channels",":","the","number","of","input","channels",":","param","d_t_emb",":","the","size","of","timestep","embeddings",":","param","out_channels",":","is","the","number","of","out","channels",".","defaults","to","`","channels","."]
code: def __init__(self, channels: int, d_t_emb: int, *, out_channels=None):
      """
      :param channels: the number of input channels
      :param d_t_emb: the size of timestep embeddings
      :param out_channels: is the number of out channels. defaults to `channels.
      """
      super().__init__()
      # `out_channels` not specified
      if out_channels is None:
          out_channels = channels
  
      # First normalization and convolution
      self.in_layers = nn.Sequential(
          normalization(channels),
          nn.SiLU(),
          nn.Conv2d(channels, out_channels, 3, padding=1),
      )
  
      # Time step embeddings
      self.emb_layers = nn.Sequential(
          nn.SiLU(),
          nn.Linear(d_t_emb, out_channels),
      )
      # Final convolution layer
      self.out_layers = nn.Sequential(
          normalization(out_channels),
          nn.SiLU(),
          nn.Dropout(0.0),
          nn.Conv2d(out_channels, out_channels, 3, padding=1),
      )
  
      # `channels` to `out_channels` mapping layer for residual connection
      if out_channels == channels:
          self.skip_connection = nn.Identity()
      else:
          self.skip_connection = nn.Conv2d(channels, out_channels, 1)
  
imports: import math
  from typing import List
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from labml_nn.diffusion.stable_diffusion.model.unet_attention import SpatialTransformer
label_desc: Use image node_id 1 to create a new ResBlock object from inherited base classes: nn with example: obj = ResBlock(channels, d_t_emb)