code: def test_validate_resnet_inputs_detection(self):
      # default number of backbone layers to train
      ret = backbone_utils._validate_trainable_layers(
          is_trained=True,
          trainable_backbone_layers=None,
          max_value=5,
          default_value=3,
      )
      assert ret == 3
      # can't go beyond 5
      with pytest.raises(
          ValueError,
          match=r"Trainable backbone layers should be in the range",
      ):
          ret = backbone_utils._validate_trainable_layers(
              is_trained=True,
              trainable_backbone_layers=6,
              max_value=5,
              default_value=3,
          )
      # if not trained, should use all trainable layers and warn
      with pytest.warns(UserWarning):
          ret = backbone_utils._validate_trainable_layers(
              is_trained=False,
              trainable_backbone_layers=0,
              max_value=5,
              default_value=3,
          )
      assert ret == 5
  
file_path: vision/test/test_models_detection_utils.py
imports: import copy
  import pytest
  import torch
  from common_utils import assert_equal
  from torchvision.models.detection import _utils, backbone_utils
  from torchvision.models.detection.transform import GeneralizedRCNNTransform
label_desc: Use image node_id 4 for calling the TestModelsDetectionUtils obj's underlying member method code with example usage: obj.test_validate_resnet_inputs_detection() without return types