code: def test_pathsampling_cell():
      for cell_cls in [
          CellSimple,
          CellDefaultArgs,
          CellCustomProcessor,
          CellLooseEnd,
          CellOpFactory,
      ]:
          model = cell_cls()
          strategy = RandomOneShot()
          model = strategy.mutate_model(model)
          nas_modules = [
              m
              for m in model.modules()
              if isinstance(m, BaseSuperNetModule)
          ]
          result = {}
          for module in nas_modules:
              result.update(module.resample(memo=result))
          assert (
              len(result)
              == model.cell.num_nodes * model.cell.num_ops_per_node * 2
          )
          result = {}
          for module in nas_modules:
              result.update(module.export(memo=result))
          assert (
              len(result)
              == model.cell.num_nodes * model.cell.num_ops_per_node * 2
          )
  
          if cell_cls in [CellLooseEnd, CellOpFactory]:
              assert isinstance(model.cell, PathSamplingCell)
          else:
              assert not isinstance(model.cell, PathSamplingCell)
  
          inputs = {
              CellSimple: (torch.randn(2, 16), torch.randn(2, 16)),
              CellDefaultArgs: (torch.randn(2, 16),),
              CellCustomProcessor: (
                  torch.randn(2, 3),
                  torch.randn(2, 16),
              ),
              CellLooseEnd: (torch.randn(2, 16), torch.randn(2, 16)),
              CellOpFactory: (torch.randn(2, 3), torch.randn(2, 16)),
          }[cell_cls]
  
          output = model(*inputs)
          if cell_cls == CellCustomProcessor:
              assert (
                  isinstance(output, tuple)
                  and len(output) == 2
                  and output[1].shape
                  == torch.Size([2, 16 * model.cell.num_nodes])
              )
          else:
              # no loose-end support for now
              assert output.shape == torch.Size(
                  [2, 16 * model.cell.num_nodes]
              )
  
imports: import pytest
  import numpy
  import torch
  import torch.nn
  import nni
  from nni.mutable import MutableList, frozen
  from nni.nas.nn.pytorch import LayerChoice, ModelSpace, Cell, MutableConv2d, MutableBatchNorm2d, MutableLayerNorm, MutableLinear, MutableMultiheadAttention
  from nni.nas.oneshot.pytorch.differentiable import DartsLightningModule
  from nni.nas.oneshot.pytorch.strategy import RandomOneShot, DARTS
  from nni.nas.oneshot.pytorch.supermodule.base import BaseSuperNetModule
  from nni.nas.oneshot.pytorch.supermodule.differentiable import MixedOpDifferentiablePolicy, DifferentiableMixedLayer, DifferentiableMixedInput, GumbelSoftmax, DifferentiableMixedRepeat, DifferentiableMixedCell
  from nni.nas.oneshot.pytorch.supermodule.sampling import MixedOpPathSamplingPolicy, PathSamplingLayer, PathSamplingInput, PathSamplingRepeat, PathSamplingCell
  from nni.nas.oneshot.pytorch.supermodule.operation import MixedConv2d, NATIVE_MIXED_OPERATIONS
  from nni.nas.oneshot.pytorch.supermodule.proxyless import ProxylessMixedLayer, ProxylessMixedInput
  from nni.nas.oneshot.pytorch.supermodule._operation_utils import Slicable, MaybeWeighted
  from nni.nas.oneshot.pytorch.supermodule._expression_utils import *
  from ut.nas.nn.models import CellSimple, CellDefaultArgs, CellCustomProcessor, CellLooseEnd, CellOpFactory
label_desc: Use image node_id 24 for calling a global function with example usage: test_pathsampling_cell() without return types