class_docstr: DiNTS topology search space of neural architectures.
  
  Examples:
  
  .. code-block:: python
  
      from monai.networks.nets.dints import TopologySearch
  
      topology_search_space = TopologySearch(
          channel_mul=0.5, num_blocks=8, num_depths=4, use_downsample=True, spatial_dims=3)
      topology_search_space.get_ram_cost_usage(in_size=(2, 16, 80, 80, 80), full=True)
      multi_res_images = [
          torch.randn(2, 16, 80, 80, 80),
          torch.randn(2, 32, 40, 40, 40),
          torch.randn(2, 64, 20, 20, 20),
          torch.randn(2, 128, 10, 10, 10)]
      prediction = topology_search_space(image)
      for x in prediction: print(x.shape)
      # torch.Size([2, 16, 80, 80, 80])
      # torch.Size([2, 32, 40, 40, 40])
      # torch.Size([2, 64, 20, 20, 20])
      # torch.Size([2, 128, 10, 10, 10])
  
  Class method overview:
  
      - ``get_prob_a()``: convert learnable architecture weights to path activation probabilities.
      - ``get_ram_cost_usage()``: get estimated ram cost.
      - ``get_topology_entropy()``: get topology entropy loss in searching stage.
      - ``decode()``: get final binarized architecture code.
      - ``gen_mtx()``: generate variables needed for topology search.
  
  Predefined variables:
      - `tidx`: index used to convert path activation matrix T = (depth,depth) in transfer_mtx to
        path activation arch_code (1,3*depth-2), for depth = 4, tidx = [0, 1, 4, 5, 6, 9, 10, 11, 14, 15],
        A tidx (10 binary values) represents the path activation.
      - `transfer_mtx`: feasible path activation matrix (denoted as T) given a node activation pattern.
        It is used to convert path activation pattern (1, paths) to node activation (1, nodes)
      - `node_act_list`: all node activation [2^num_depths-1, depth]. For depth = 4, there are 15 node activation
        patterns, each of length 4. For example, [1,1,0,0] means nodes 0, 1 are activated (with input paths).
      - `all_connect`: All possible path activations. For depth = 4,
        all_connection has 1024 vectors of length 10 (10 paths).
        The return value will exclude path activation of all 0.
class_docstr_tok: ["DiNTS","topology","search","space","of","neural","architectures",".","Examples",":","..","code-block",":",":","python","from","monai.networks.nets.dints","import","TopologySearch","topology_search_space","=","TopologySearch","(","channel_mul=0.5",",","num_blocks=8",",","num_depths=4",",","use_downsample=True",",","spatial_dims=3",")","topology_search_space.get_ram_cost_usage","(","in_size=","(","2",",","16",",","80",",","80",",","80",")",",","full=True",")","multi_res_images","=","[","torch.randn","(","2",",","16",",","80",",","80",",","80",")",",","torch.randn","(","2",",","32",",","40",",","40",",","40",")",",","torch.randn","(","2",",","64",",","20",",","20",",","20",")",",","torch.randn","(","2",",","128",",","10",",","10",",","10",")","]","prediction","=","topology_search_space","(","image",")","for","x","in","prediction",":","print","(","x.shape",")","#","torch.Size","(","[","2",",","16",",","80",",","80",",","80","]",")","#","torch.Size","(","[","2",",","32",",","40",",","40",",","40","]",")","#","torch.Size","(","[","2",",","64",",","20",",","20",",","20","]",")","#","torch.Size","(","[","2",",","128",",","10",",","10",",","10","]",")","Class","method","overview",":","-","``","get_prob_a","(",")","``",":","convert","learnable","architecture","weights","to","path","activation","probabilities",".","-","``","get_ram_cost_usage","(",")","``",":","get","estimated","ram","cost",".","-","``","get_topology_entropy","(",")","``",":","get","topology","entropy","loss","in","searching","stage",".","-","``","decode","(",")","``",":","get","final","binarized","architecture","code",".","-","``","gen_mtx","(",")","``",":","generate","variables","needed","for","topology","search",".","Predefined","variables",":","-","`","tidx","`",":","index","used","to","convert","path","activation","matrix","T","=","(","depth",",","depth",")","in","transfer_mtx","to","path","activation","arch_code","(","1,3","*","depth-2",")",",","for","depth","=","4",",","tidx","=","[","0",",","1",",","4",",","5",",","6",",","9",",","10",",","11",",","14",",","15","]",",","A","tidx","(","10","binary","values",")","represents","the","path","activation",".","-","`","transfer_mtx","`",":","feasible","path","activation","matrix","(","denoted","as","T",")","given","a","node","activation","pattern",".","It","is","used","to","convert","path","activation","pattern","(","1",",","paths",")","to","node","activation","(","1",",","nodes",")","-","`","node_act_list","`",":","all","node","activation","[","2^num_depths-1",",","depth","]",".","For","depth","=","4",",","there","are","15","node","activation","patterns",",","each","of","length","4",".","For","example",",","[","1,1,0,0","]","means","nodes","0",",","1","are","activated","(","with","input","paths",")",".","-","`","all_connect","`",":","All","possible","path","activations",".","For","depth","=","4",",","all_connection","has","1024","vectors","of","length","10","(","10","paths",")",".","The","return","value","will","exclude","path","activation","of","all","0","."]
docstr: Prediction based on dynamic arch_code.
  
  Args:
      x: a list of `num_depths` input tensors as a multi-resolution input.
          tensor is of shape `BCHW[D]` where `C` must match `self.filter_nums`.
docstr_tok: ["Prediction","based","on","dynamic","arch_code",".","Args",":","x",":","a","list","of","`","num_depths","`","input","tensors","as","a","multi-resolution","input",".","tensor","is","of","shape","`","BCHW","[","D","]","`","where","`","C","`","must","match","`","self.filter_nums","`","."]
code: def forward(self, x):
      """
      Prediction based on dynamic arch_code.
  
      Args:
          x: a list of `num_depths` input tensors as a multi-resolution input.
              tensor is of shape `BCHW[D]` where `C` must match `self.filter_nums`.
      """
      # generate path activation probability
      probs_a, arch_code_prob_a = self.get_prob_a(child=False)
      inputs = x
      for blk_idx in range(self.num_blocks):
          outputs = [0.0] * self.num_depths
          for res_idx, activation in enumerate(
              self.arch_code_a[blk_idx].data.cpu().numpy()
          ):
              if activation:
                  _w = F.softmax(
                      self.log_alpha_c[blk_idx, res_idx], dim=-1
                  )
                  outputs[self.arch_code2out[res_idx]] += (
                      self.cell_tree[str((blk_idx, res_idx))](
                          inputs[self.arch_code2in[res_idx]], weight=_w
                      )
                      * arch_code_prob_a[blk_idx, res_idx]
                  )
          inputs = outputs
  
      return inputs
  
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 8 for calling the TopologySearch obj's underlying member method code with example usage: obj.forward(x) and returns: inputs