class_docstr: A Resnet block.
  
  Parameters:
      in_channels (`int`): The number of channels in the input.
      out_channels (`int`, *optional*, default to be `None`):
          The number of output channels for the first conv2d layer. If None, same as `in_channels`.
      temb_channels (`int`, *optional*, default to `512`): the number of channels in timestep embedding.
      eps (`float`, *optional*, defaults to `1e-6`): The epsilon to use for the normalization.
class_docstr_tok: ["A","Resnet","block",".","Parameters",":","in_channels","(","`","int","`",")",":","The","number","of","channels","in","the","input",".","out_channels","(","`","int","`",",","*","optional","*",",","default","to","be","`","None","`",")",":","The","number","of","output","channels","for","the","first","conv2d","layer",".","If","None",",","same","as","`","in_channels","`",".","temb_channels","(","`","int","`",",","*","optional","*",",","default","to","`","512","`",")",":","the","number","of","channels","in","timestep","embedding",".","eps","(","`","float","`",",","*","optional","*",",","defaults","to","`","1e-6","`",")",":","The","epsilon","to","use","for","the","normalization","."]
code: def forward(
      self, input_tensor: torch.FloatTensor, temb: torch.FloatTensor
  ) -> torch.FloatTensor:
      hidden_states = input_tensor
  
      hidden_states = self.norm1(hidden_states)
      hidden_states = self.nonlinearity(hidden_states)
      hidden_states = self.conv1(hidden_states)
  
      if self.time_emb_proj is not None:
          temb = self.nonlinearity(temb)
          temb = self.time_emb_proj(temb)[:, :, :, None, None]
          temb = temb.permute(0, 2, 1, 3, 4)
          hidden_states = hidden_states + temb
  
      hidden_states = self.norm2(hidden_states)
      hidden_states = self.nonlinearity(hidden_states)
      hidden_states = self.dropout(hidden_states)
      hidden_states = self.conv2(hidden_states)
  
      if self.conv_shortcut is not None:
          input_tensor = self.conv_shortcut(input_tensor)
  
      output_tensor = input_tensor + hidden_states
  
      return output_tensor
  
imports: from functools import partial
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from ..utils import USE_PEFT_BACKEND
  from .activations import get_activation
  from .attention_processor import SpatialNorm
  from .downsampling import Downsample1D, Downsample2D, FirDownsample2D, KDownsample2D, downsample_2d
  from .lora import LoRACompatibleConv, LoRACompatibleLinear
  from .normalization import AdaGroupNorm
  from .upsampling import FirUpsample2D, KUpsample2D, Upsample1D, Upsample2D, upfirdn2d_native, upsample_2d
label_desc: Use image node_id 2 for calling the TemporalResnetBlock obj's underlying member method code with example usage: obj.forward(input_tensor, temb) and returns: output_tensor