code: def forward(
      self,
      hidden_state: Tensor,
      output_hidden_states: bool = False,
      return_dict: bool = True,
  ) -> BaseModelOutputWithNoAttention:
      hidden_states = () if output_hidden_states else None
  
      for stage_module in self.stages:
          if output_hidden_states:
              hidden_states = hidden_states + (hidden_state,)
  
          hidden_state = stage_module(hidden_state)
  
      if output_hidden_states:
          hidden_states = hidden_states + (hidden_state,)
  
      if not return_dict:
          return tuple(
              v for v in [hidden_state, hidden_states] if v is not None
          )
  
      return BaseModelOutputWithNoAttention(
          last_hidden_state=hidden_state,
          hidden_states=hidden_states,
      )
  
imports: from typing import Optional
  import torch
  import torch.utils.checkpoint
  from torch import Tensor, nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_resnet import ResNetConfig
label_desc: Use image node_id 2 for calling the ResNetEncoder obj's underlying member method code with example usage: obj.forward(hidden_state, output_hidden_states, return_dict) and returns: BaseModelOutputWithNoAttention, tuple