code: def model_scaling(layer_setting, arch_setting):
      """Scaling operation to the layer's parameters according to the
      arch_setting."""
      # scale width
      new_layer_setting = copy.deepcopy(layer_setting)
      for layer_cfg in new_layer_setting:
          for block_cfg in layer_cfg:
              block_cfg[1] = make_divisible(
                  block_cfg[1] * arch_setting[0], 8
              )
  
      # scale depth
      split_layer_setting = [new_layer_setting[0]]
      for layer_cfg in new_layer_setting[1:-1]:
          tmp_index = [0]
          for i in range(len(layer_cfg) - 1):
              if layer_cfg[i + 1][1] != layer_cfg[i][1]:
                  tmp_index.append(i + 1)
          tmp_index.append(len(layer_cfg))
          for i in range(len(tmp_index) - 1):
              split_layer_setting.append(
                  layer_cfg[tmp_index[i] : tmp_index[i + 1]]
              )
      split_layer_setting.append(new_layer_setting[-1])
  
      num_of_layers = [
          len(layer_cfg) for layer_cfg in split_layer_setting[1:-1]
      ]
      new_layers = [
          int(math.ceil(arch_setting[1] * num)) for num in num_of_layers
      ]
  
      merge_layer_setting = [split_layer_setting[0]]
      for i, layer_cfg in enumerate(split_layer_setting[1:-1]):
          if new_layers[i] <= num_of_layers[i]:
              tmp_layer_cfg = layer_cfg[: new_layers[i]]
          else:
              tmp_layer_cfg = copy.deepcopy(layer_cfg) + [
                  layer_cfg[-1]
              ] * (new_layers[i] - num_of_layers[i])
          if tmp_layer_cfg[0][3] == 1 and i != 0:
              merge_layer_setting[-1] += tmp_layer_cfg.copy()
          else:
              merge_layer_setting.append(tmp_layer_cfg.copy())
      merge_layer_setting.append(split_layer_setting[-1])
  
      return merge_layer_setting
  
imports: import copy
  import math
  from functools import partial
  import torch
  import torch.nn
  import torch.utils.checkpoint
  from mmcv.cnn.bricks import ConvModule, DropPath
  from mmengine.model import BaseModule, Sequential
  from mmdet.registry import MODELS
  from ..layers import InvertedResidual, SELayer
  from ..utils import make_divisible
label_desc: Use image node_id 1 for calling a global function with example usage: model_scaling(layer_setting, arch_setting) and returns: merge_layer_setting