code: def forward(
      self,
      hidden_states: torch.FloatTensor,
      output_hidden_states: Optional[bool] = False,
      return_dict: Optional[bool] = True,
  ) -> Union[Tuple, BaseModelOutputWithNoAttention]:
      all_hidden_states = () if output_hidden_states else None
  
      for i, layer_module in enumerate(self.stages):
          if output_hidden_states:
              all_hidden_states = all_hidden_states + (hidden_states,)
  
          hidden_states = layer_module(hidden_states)
  
      if output_hidden_states:
          all_hidden_states = all_hidden_states + (hidden_states,)
  
      if not return_dict:
          return tuple(
              v
              for v in [hidden_states, all_hidden_states]
              if v is not None
          )
  
      return BaseModelOutputWithNoAttention(
          last_hidden_state=hidden_states,
          hidden_states=all_hidden_states,
      )
  
imports: from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BackboneOutput, 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, replace_return_docstrings
  from ...utils.backbone_utils import BackboneMixin
  from .configuration_convnext import ConvNextConfig
label_desc: Use image node_id 2 for calling the ConvNextEncoder obj's underlying member method code with example usage: obj.forward(hidden_states, output_hidden_states, return_dict) and returns: BaseModelOutputWithNoAttention, tuple