class_docstr: A residual block that can optionally change the number of channels.
  :param channels: the number of input channels.
  :param emb_channels: the number of timestep embedding channels.
  :param dropout: the rate of dropout.
  :param out_channels: if specified, the number of out channels.
  :param use_conv: if True and out_channels is specified, use a spatial
      convolution instead of a smaller 1x1 convolution to change the
      channels in the skip connection.
  :param dims: determines if the signal is 1D, 2D, or 3D.
  :param use_checkpoint: if True, use gradient checkpointing on this module.
  :param up: if True, use this block for upsampling.
  :param down: if True, use this block for downsampling.
class_docstr_tok: ["A","residual","block","that","can","optionally","change","the","number","of","channels",".",":","param","channels",":","the","number","of","input","channels",".",":","param","emb_channels",":","the","number","of","timestep","embedding","channels",".",":","param","dropout",":","the","rate","of","dropout",".",":","param","out_channels",":","if","specified",",","the","number","of","out","channels",".",":","param","use_conv",":","if","True","and","out_channels","is","specified",",","use","a","spatial","convolution","instead","of","a","smaller","1x1","convolution","to","change","the","channels","in","the","skip","connection",".",":","param","dims",":","determines","if","the","signal","is","1D",",","2D",",","or","3D",".",":","param","use_checkpoint",":","if","True",",","use","gradient","checkpointing","on","this","module",".",":","param","up",":","if","True",",","use","this","block","for","upsampling",".",":","param","down",":","if","True",",","use","this","block","for","downsampling","."]
docstr: Apply the block to a Tensor, conditioned on a timestep embedding.
  :param x: an [N x C x ...] Tensor of features.
  :param emb: an [N x emb_channels] Tensor of timestep embeddings.
  :return: an [N x C x ...] Tensor of outputs.
docstr_tok: ["Apply","the","block","to","a","Tensor",",","conditioned","on","a","timestep","embedding",".",":","param","x",":","an","[","N","x","C","x","...","]","Tensor","of","features",".",":","param","emb",":","an","[","N","x","emb_channels","]","Tensor","of","timestep","embeddings",".",":","return",":","an","[","N","x","C","x","...","]","Tensor","of","outputs","."]
code: def forward(self, x: th.Tensor, emb: th.Tensor) -> th.Tensor:
      """
      Apply the block to a Tensor, conditioned on a timestep embedding.
      :param x: an [N x C x ...] Tensor of features.
      :param emb: an [N x emb_channels] Tensor of timestep embeddings.
      :return: an [N x C x ...] Tensor of outputs.
      """
      if self.use_checkpoint:
          return checkpoint(self._forward, x, emb)
      else:
          return self._forward(x, emb)
  
imports: import logging
  import math
  from abc import abstractmethod
  from typing import Iterable, List, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from einops import rearrange
  from torch.utils.checkpoint import checkpoint
  from ...modules.attention import SpatialTransformer
  from ...modules.diffusionmodules.util import avg_pool_nd, conv_nd, linear, normalization, timestep_embedding, zero_module
  from ...modules.video_attention import SpatialVideoTransformer
  from ...util import exists
label_desc: Use image node_id 2 for calling the ResBlock obj's underlying member method code with example usage: obj.forward(x, emb) and returns: checkpoint, self