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","."]
code: def _forward(self, x, emb):
      if self.updown:
          in_rest, in_conv = self.in_layers[:-1], self.in_layers[-1]
          h = in_rest(x)
          h = self.h_upd(h)
          x = self.x_upd(x)
          h = in_conv(h)
      else:
          h = self.in_layers(x)
      emb_out = self.emb_layers(emb).type(h.dtype)
      while len(emb_out.shape) < len(h.shape):
          emb_out = emb_out[..., None]
      if self.use_scale_shift_norm:
          out_norm, out_rest = self.out_layers[0], self.out_layers[1:]
          scale, shift = th.chunk(emb_out, 2, dim=1)
          h = out_norm(h) * (1 + scale) + shift
          h = out_rest(h)
      else:
          h = h + emb_out
          h = self.out_layers(h)
      return self.skip_connection(x) + h
  
imports: from abc import abstractmethod
  import math
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ldm.modules.diffusionmodules.util import checkpoint, conv_nd, linear, avg_pool_nd, zero_module, normalization, timestep_embedding
  from ldm.modules.attention import SpatialTransformer
  from ldm.util import exists
label_desc: Use image node_id 3 for calling the ResBlock obj's underlying member method code with example usage: obj._forward(x, emb) and returns: unknown