code: def get_in_feature_dimension(image_classifier: nn.Module) -> int:
      """Return the input feature dimension to the image classification head."""
      in_features = None
      if isinstance(image_classifier, nn.Sequential):
          # Classifier that uses nn.Sequential usually has global pooling and
          # multiple linear layers. Find the first linear layer and get its
          # in_features
          for layer in image_classifier:
              if isinstance(layer, (nn.Linear, LinearLayer)):
                  in_features = layer.in_features
                  break
      elif isinstance(image_classifier, (nn.Linear, LinearLayer)):
          in_features = image_classifier.in_features
  
      if in_features is None:
          raise NotImplementedError(
              f"Cannot get input feature dimension of {image_classifier}."
          )
  
      return in_features
  
file_path: ml-cvnets/cvnets/image_projection_layers/base_image_projection.py
imports: import argparse
  from typing import Dict, Optional
  from torch import nn
  from cvnets.layers import LinearLayer
  from cvnets.misc.common import parameter_list
label_desc: Use image node_id 1 for calling a global function with example usage: get_in_feature_dimension(image_classifier) and returns: in_features