class_docstr: The implementation of super-net cell follows `DARTS <https://github.com/quark0/darts>`__.
  
  When ``factory_used`` is true, it reconstructs the cell for every possible combination of operation and input index,
  because for different input index, the cell factory could instantiate different operations (e.g., with different stride).
  On export, we first have best (operation, input) pairs, the select the best ``num_ops_per_node``.
  
  ``loose_end`` is not supported yet, because it will cause more problems (e.g., shape mismatch).
  We assumes ``loose_end`` to be ``all`` regardless of its configuration.
  
  A supernet cell can't slim its own weight to fit into a sub network, which is also a known issue.
class_docstr_tok: ["The","implementation","of","super-net","cell","follows","`","DARTS","<","https",":","\/\/github.com\/quark0\/darts",">","`","__",".","When","``","factory_used","``","is","true",",","it","reconstructs","the","cell","for","every","possible","combination","of","operation","and","input","index",",","because","for","different","input","index",",","the","cell","factory","could","instantiate","different","operations","(","e.g.",",","with","different","stride",")",".","On","export",",","we","first","have","best","(","operation",",","input",")","pairs",",","the","select","the","best","``","num_ops_per_node","``",".","``","loose_end","``","is","not","supported","yet",",","because","it","will","cause","more","problems","(","e.g.",",","shape","mismatch",")",".","We","assumes","``","loose_end","``","to","be","``","all","``","regardless","of","its","configuration",".","A","supernet","cell","ca","n't","slim","its","own","weight","to","fit","into","a","sub","network",",","which","is","also","a","known","issue","."]
docstr: Random choose one path if label is not found in memo.
code: def resample(self, memo):
      """Random choose one path if label is not found in memo."""
      self._sampled = {}
      new_sampled = {}
      for label, param_spec in self.simplify().items():
          if label in memo:
              if isinstance(memo[label], list) and len(memo[label]) > 1:
                  raise ValueError(
                      f"Multi-path sampling is currently unsupported on cell: {memo[label]}"
                  )
              self._sampled[label] = memo[label]
          else:
              if isinstance(param_spec, Categorical):
                  self._sampled[label] = new_sampled[
                      label
                  ] = random.choice(param_spec.values)
              elif isinstance(param_spec, CategoricalMultiple):
                  assert param_spec.n_chosen == 1
                  self._sampled[label] = new_sampled[label] = [
                      random.choice(param_spec.values)
                  ]
      return new_sampled
  
imports: from __future__ import annotations
  import copy
  import functools
  import random
  from typing import Any, List, Dict, Sequence, cast
  import torch
  import torch.nn
  from nni.mutable import MutableExpression, label_scope, Mutable, Categorical, CategoricalMultiple
  from nni.nas.nn.pytorch import LayerChoice, InputChoice, Repeat, Cell
  from nni.nas.nn.pytorch.cell import CellOpFactory, create_cell_op_candidates, preprocess_cell_inputs
  from .base import BaseSuperNetModule
  from ._expression_utils import weighted_sum
  from .operation import MixedOperationSamplingPolicy, MixedOperation
label_desc: Use image node_id 4 for calling the PathSamplingCell obj's underlying member method code with example usage: obj.resample(memo) and returns: new_sampled