code: def get_down_block(
      down_block_type,
      num_layers,
      in_channels,
      out_channels,
      temb_channels,
      add_downsample,
      resnet_eps,
      resnet_act_fn,
      num_attention_heads,
      resnet_groups=None,
      cross_attention_dim=None,
      downsample_padding=None,
      dual_cross_attention=False,
      use_linear_projection=True,
      only_cross_attention=False,
      upcast_attention=False,
      resnet_time_scale_shift="default",
  ):
      if down_block_type == "DownBlock3D":
          return DownBlock3D(
              num_layers=num_layers,
              in_channels=in_channels,
              out_channels=out_channels,
              temb_channels=temb_channels,
              add_downsample=add_downsample,
              resnet_eps=resnet_eps,
              resnet_act_fn=resnet_act_fn,
              resnet_groups=resnet_groups,
              downsample_padding=downsample_padding,
              resnet_time_scale_shift=resnet_time_scale_shift,
          )
      elif down_block_type == "CrossAttnDownBlock3D":
          if cross_attention_dim is None:
              raise ValueError(
                  "cross_attention_dim must be specified for CrossAttnDownBlock3D"
              )
          return CrossAttnDownBlock3D(
              num_layers=num_layers,
              in_channels=in_channels,
              out_channels=out_channels,
              temb_channels=temb_channels,
              add_downsample=add_downsample,
              resnet_eps=resnet_eps,
              resnet_act_fn=resnet_act_fn,
              resnet_groups=resnet_groups,
              downsample_padding=downsample_padding,
              cross_attention_dim=cross_attention_dim,
              num_attention_heads=num_attention_heads,
              dual_cross_attention=dual_cross_attention,
              use_linear_projection=use_linear_projection,
              only_cross_attention=only_cross_attention,
              upcast_attention=upcast_attention,
              resnet_time_scale_shift=resnet_time_scale_shift,
          )
      raise ValueError(f"{down_block_type} does not exist.")
  
imports: import torch
  from torch import nn
  from ..utils.torch_utils import apply_freeu
  from .resnet import Downsample2D, ResnetBlock2D, TemporalConvLayer, Upsample2D
  from .transformer_2d import Transformer2DModel
  from .transformer_temporal import TransformerTemporalModel
label_desc: Use image node_id 1 for calling a global function with example usage: get_down_block(down_block_type, num_layers, in_channels, out_channels, temb_channels, add_downsample, resnet_eps, resnet_act_fn, num_attention_heads, resnet_groups, cross_attention_dim, downsample_padding, dual_cross_attention, use_linear_projection, only_cross_attention, upcast_attention, resnet_time_scale_shift) and returns: DownBlock3D, CrossAttnDownBlock3D