code: def forward(
      self,
      hidden_states,
      temb=None,
      encoder_hidden_states=None,
      attention_mask=None,
      num_frames=1,
      cross_attention_kwargs=None,
  ):
      hidden_states = self.resnets[0](hidden_states, temb)
      hidden_states = self.temp_convs[0](
          hidden_states, num_frames=num_frames
      )
      for attn, temp_attn, resnet, temp_conv in zip(
          self.attentions,
          self.temp_attentions,
          self.resnets[1:],
          self.temp_convs[1:],
      ):
          hidden_states = attn(
              hidden_states,
              encoder_hidden_states=encoder_hidden_states,
              cross_attention_kwargs=cross_attention_kwargs,
              return_dict=False,
          )[0]
          hidden_states = temp_attn(
              hidden_states,
              num_frames=num_frames,
              cross_attention_kwargs=cross_attention_kwargs,
              return_dict=False,
          )[0]
          hidden_states = resnet(hidden_states, temb)
          hidden_states = temp_conv(
              hidden_states, num_frames=num_frames
          )
  
      return hidden_states
  
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 2 for calling the UNetMidBlock3DCrossAttn obj's underlying member method code with example usage: obj.forward(hidden_states, temb, encoder_hidden_states, attention_mask, num_frames, cross_attention_kwargs) and returns: hidden_states