code: def generate_regnet_parameters(w_a, w_0, w_m, d, q=8):
      """Generates per stage widths and depths from RegNet parameters."""
      assert w_a >= 0 and w_0 > 0 and w_m > 1 and w_0 % q == 0
      # Generate continuous per-block ws
      ws_cont = np.arange(d) * w_a + w_0
      # Generate quantized per-block ws
      ks = np.round(np.log(ws_cont / w_0) / np.log(w_m))
      ws_all = w_0 * np.power(w_m, ks)
      ws_all = np.round(np.divide(ws_all, q)).astype(int) * q
      # Generate per stage ws and ds (assumes ws_all are sorted)
      ws, ds = np.unique(ws_all, return_counts=True)
      # Compute number of actual stages and total possible stages
      num_stages, total_stages = len(ws), ks.max() + 1
      # Convert numpy arrays to lists and return
      ws, ds, ws_all, ws_cont = (
          x.tolist() for x in (ws, ds, ws_all, ws_cont)
      )
      return ws, ds, num_stages, total_stages, ws_all, ws_cont
  
imports: import numpy
  from torch import nn
  from detectron2.layers import CNNBlockBase, ShapeSpec, get_norm
  from .backbone import Backbone
label_desc: Use image node_id 6 for calling a global function with example usage: generate_regnet_parameters(w_a, w_0, w_m, d, q) and returns: ws,  ds,  num_stages,  total_stages,  ws_all,  ws_cont