class_docstr: A residual block that can optionally change the number of channels.
  
  Arguments
  ---------
  channels: int
      the number of input channels.
  emb_channels: int
      the number of timestep embedding channels.
  dropout: float
      the rate of dropout.
  out_channels: int
      if specified, the number of out channels.
  use_conv: bool
      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.
  dims: int
      determines if the signal is 1D, 2D, or 3D.
  up: bool
      if True, use this block for upsampling.
  down: bool
      if True, use this block for downsampling.
  norm_num_groups: int
      the number of groups for group normalization
  use_fixup_init: bool
      whether to use FixUp initialization
  
  Example
  -------
  >>> res = ResBlock(
  ...     channels=4,
  ...     emb_channels=8,
  ...     dropout=0.1,
  ...     norm_num_groups=2,
  ...     use_conv=True,
  ... )
  >>> x = torch.randn(2, 4, 32, 32)
  >>> emb = torch.randn(2, 8)
  >>> res_out = res(x, emb)
  >>> res_out.shape
  torch.Size([2, 4, 32, 32])
class_docstr_tok: ["A","residual","block","that","can","optionally","change","the","number","of","channels",".","Arguments","--","--","--","--","-","channels",":","int","the","number","of","input","channels",".","emb_channels",":","int","the","number","of","timestep","embedding","channels",".","dropout",":","float","the","rate","of","dropout",".","out_channels",":","int","if","specified",",","the","number","of","out","channels",".","use_conv",":","bool","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",".","dims",":","int","determines","if","the","signal","is","1D",",","2D",",","or","3D",".","up",":","bool","if","True",",","use","this","block","for","upsampling",".","down",":","bool","if","True",",","use","this","block","for","downsampling",".","norm_num_groups",":","int","the","number","of","groups","for","group","normalization","use_fixup_init",":","bool","whether","to","use","FixUp","initialization","Example","--","--","--","-",">",">",">","res","=","ResBlock","(","...","channels=4",",","...","emb_channels=8",",","...","dropout=0.1",",","...","norm_num_groups=2",",","...","use_conv=True",",","...",")",">",">",">","x","=","torch.randn","(","2",",","4",",","32",",","32",")",">",">",">","emb","=","torch.randn","(","2",",","8",")",">",">",">","res_out","=","res","(","x",",","emb",")",">",">",">","res_out.shape","torch.Size","(","[","2",",","4",",","32",",","32","]",")"]
docstr: Apply the block to a Tensor, conditioned on a timestep embedding.
  
  Arguments
  ---------
  x: torch.Tensor
      an [N x C x ...] Tensor of features.
  emb: torch.Tensor
      an [N x emb_channels] Tensor of timestep embeddings.
  
  Returns
  -------
  result: torch.Tensor
      an [N x C x ...] Tensor of outputs.
docstr_tok: ["Apply","the","block","to","a","Tensor",",","conditioned","on","a","timestep","embedding",".","Arguments","--","--","--","--","-","x",":","torch.Tensor","an","[","N","x","C","x","...","]","Tensor","of","features",".","emb",":","torch.Tensor","an","[","N","x","emb_channels","]","Tensor","of","timestep","embeddings",".","Returns","--","--","--","-","result",":","torch.Tensor","an","[","N","x","C","x","...","]","Tensor","of","outputs","."]
code: def forward(self, x, emb=None):
      """
      Apply the block to a Tensor, conditioned on a timestep embedding.
  
      Arguments
      ---------
      x: torch.Tensor
          an [N x C x ...] Tensor of features.
      emb: torch.Tensor
          an [N x emb_channels] Tensor of timestep embeddings.
  
      Returns
      -------
      result: torch.Tensor
          an [N x C x ...] Tensor of outputs.
      """
      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)
      if emb is not None:
          emb_out = self.emb_layers(emb).type(h.dtype)
          while len(emb_out.shape) < len(h.shape):
              emb_out = emb_out[..., None]
      else:
          emb_out = torch.zeros_like(h)
  
      h = h + emb_out
      h = self.out_layers(h)
      return self.skip_connection(x) + h
  
imports: from abc import abstractmethod
  from speechbrain.utils.data_utils import pad_divisible
  from .autoencoders import NormalizingAutoencoder
  import math
  import torch
  import torch.nn
  import torch.nn.functional
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: unknown