class_docstr: The base class for `TopologyInstance` and `TopologySearch`.
  
  Args:
      arch_code: `[arch_code_a, arch_code_c]`, numpy arrays. The architecture codes defining the model.
          For example, for a ``num_depths=4, num_blocks=12`` search space:
  
          - `arch_code_a` is a 12x10 (10 paths) binary matrix representing if a path is activated.
          - `arch_code_c` is a 12x10x5 (5 operations) binary matrix representing if a cell operation is used.
          - `arch_code` in ``__init__()`` is used for creating the network and remove unused network blocks. If None,
  
          all paths and cells operations will be used, and must be in the searching stage (is_search=True).
      channel_mul: adjust intermediate channel number, default is 1.
      cell: operation of each node.
      num_blocks: number of blocks (depth in the horizontal direction) of the DiNTS search space.
      num_depths: number of image resolutions of the DiNTS search space: 1, 1/2, 1/4 ... in each dimension.
      use_downsample: use downsample in the stem. If False, the search space will be in resolution [1, 1/2, 1/4, 1/8],
          if True, the search space will be in resolution [1/2, 1/4, 1/8, 1/16].
      device: `'cpu'`, `'cuda'`, or device ID.
  
  
  Predefined variables:
      `filter_nums`: default to 32. Double the number of channels after downsample.
      topology related variables:
  
          - `arch_code2in`: path activation to its incoming node index (resolution). For depth = 4,
            arch_code2in = [0, 1, 0, 1, 2, 1, 2, 3, 2, 3]. The first path outputs from node 0 (top resolution),
            the second path outputs from node 1 (second resolution in the search space),
            the third path outputs from node 0, etc.
          - `arch_code2ops`: path activation to operations of upsample 1, keep 0, downsample -1. For depth = 4,
            arch_code2ops = [0, 1, -1, 0, 1, -1, 0, 1, -1, 0]. The first path does not change
            resolution, the second path perform upsample, the third perform downsample, etc.
          - `arch_code2out`: path activation to its output node index.
            For depth = 4, arch_code2out = [0, 0, 1, 1, 1, 2, 2, 2, 3, 3],
            the first and second paths connects to node 0 (top resolution), the 3,4,5 paths connects to node 1, etc.
class_docstr_tok: ["The","base","class","for","`","TopologyInstance","`","and","`","TopologySearch","`",".","Args",":","arch_code",":","`","[","arch_code_a",",","arch_code_c","]","`",",","numpy","arrays",".","The","architecture","codes","defining","the","model",".","For","example",",","for","a","``","num_depths=4",",","num_blocks=12","``","search","space",":","-","`","arch_code_a","`","is","a","12x10","(","10","paths",")","binary","matrix","representing","if","a","path","is","activated",".","-","`","arch_code_c","`","is","a","12x10x5","(","5","operations",")","binary","matrix","representing","if","a","cell","operation","is","used",".","-","`","arch_code","`","in","``","__init__","(",")","``","is","used","for","creating","the","network","and","remove","unused","network","blocks",".","If","None",",","all","paths","and","cells","operations","will","be","used",",","and","must","be","in","the","searching","stage","(","is_search=True",")",".","channel_mul",":","adjust","intermediate","channel","number",",","default","is","1.","cell",":","operation","of","each","node",".","num_blocks",":","number","of","blocks","(","depth","in","the","horizontal","direction",")","of","the","DiNTS","search","space",".","num_depths",":","number","of","image","resolutions","of","the","DiNTS","search","space",":","1",",","1\/2",",","1\/4","...","in","each","dimension",".","use_downsample",":","use","downsample","in","the","stem",".","If","False",",","the","search","space","will","be","in","resolution","[","1",",","1\/2",",","1\/4",",","1\/8","]",",","if","True",",","the","search","space","will","be","in","resolution","[","1\/2",",","1\/4",",","1\/8",",","1\/16","]",".","device",":","`","'cpu","'","`",",","`","'cuda","'","`",",","or","device","ID",".","Predefined","variables",":","`","filter_nums","`",":","default","to","32",".","Double","the","number","of","channels","after","downsample",".","topology","related","variables",":","-","`","arch_code2in","`",":","path","activation","to","its","incoming","node","index","(","resolution",")",".","For","depth","=","4",",","arch_code2in","=","[","0",",","1",",","0",",","1",",","2",",","1",",","2",",","3",",","2",",","3","]",".","The","first","path","outputs","from","node","0","(","top","resolution",")",",","the","second","path","outputs","from","node","1","(","second","resolution","in","the","search","space",")",",","the","third","path","outputs","from","node","0",",","etc",".","-","`","arch_code2ops","`",":","path","activation","to","operations","of","upsample","1",",","keep","0",",","downsample","-1",".","For","depth","=","4",",","arch_code2ops","=","[","0",",","1",",","-1",",","0",",","1",",","-1",",","0",",","1",",","-1",",","0","]",".","The","first","path","does","not","change","resolution",",","the","second","path","perform","upsample",",","the","third","perform","downsample",",","etc",".","-","`","arch_code2out","`",":","path","activation","to","its","output","node","index",".","For","depth","=","4",",","arch_code2out","=","[","0",",","0",",","1",",","1",",","1",",","2",",","2",",","2",",","3",",","3","]",",","the","first","and","second","paths","connects","to","node","0","(","top","resolution",")",",","the","3,4,5","paths","connects","to","node","1",",","etc","."]
docstr: This function to be implemented by the architecture instances or search spaces.
docstr_tok: ["This","function","to","be","implemented","by","the","architecture","instances","or","search","spaces","."]
code: def forward(self, x):
      """This function to be implemented by the architecture instances or search spaces."""
      pass
  
imports: from __future__ import annotations
  import datetime
  import warnings
  from typing import Optional
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from monai.networks.blocks.dints_block import ActiConvNormBlock, FactorizedIncreaseBlock, FactorizedReduceBlock, P3DActiConvNormBlock
  from monai.networks.layers.factories import Conv
  from monai.networks.layers.utils import get_act_layer, get_norm_layer
  from monai.utils import optional_import
label_desc: Use image node_id 2 for calling the TopologyConstruction obj's underlying member method code with example usage: obj.forward(x) without return types