code: def forward(self, hidden_states, temb=None, scale: float = 1.0):
      output_states = ()
  
      for resnet in self.resnets:
          if self.training and self.gradient_checkpointing:
  
              def create_custom_forward(module):
                  def custom_forward(*inputs):
                      return module(*inputs)
  
                  return custom_forward
  
              if is_torch_version(">=", "1.11.0"):
                  hidden_states = torch.utils.checkpoint.checkpoint(
                      create_custom_forward(resnet),
                      hidden_states,
                      temb,
                      use_reentrant=False,
                  )
              else:
                  hidden_states = torch.utils.checkpoint.checkpoint(
                      create_custom_forward(resnet), hidden_states, temb
                  )
          else:
              hidden_states = resnet(hidden_states, temb, scale=scale)
  
          output_states = output_states + (hidden_states,)
  
      if self.downsamplers is not None:
          for downsampler in self.downsamplers:
              hidden_states = downsampler(hidden_states, scale=scale)
  
          output_states = output_states + (hidden_states,)
  
      return hidden_states, output_states
  
imports: from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ...configuration_utils import ConfigMixin, register_to_config
  from ...models import ModelMixin
  from ...models.activations import get_activation
  from ...models.attention import Attention
  from ...models.attention_processor import ADDED_KV_ATTENTION_PROCESSORS, CROSS_ATTENTION_PROCESSORS, AttentionProcessor, AttnAddedKVProcessor, AttnAddedKVProcessor2_0, AttnProcessor
  from ...models.dual_transformer_2d import DualTransformer2DModel
  from ...models.embeddings import GaussianFourierProjection, ImageHintTimeEmbedding, ImageProjection, ImageTimeEmbedding, TextImageProjection, TextImageTimeEmbedding, TextTimeEmbedding, TimestepEmbedding, Timesteps
  from ...models.transformer_2d import Transformer2DModel
  from ...models.unet_2d_condition import UNet2DConditionOutput
  from ...utils import USE_PEFT_BACKEND, is_torch_version, logging, scale_lora_layers, unscale_lora_layers
  from ...utils.torch_utils import apply_freeu
label_desc: Use image node_id 2 for calling the DownBlockFlat obj's underlying member method code with example usage: obj.forward(hidden_states, temb, scale) and returns: hidden_states,  output_states, custom_forward, module