class_docstr: Mixed input. Forward returns a weighted sum of candidates.
  Implementation is very similar to :class:`DifferentiableMixedLayer`.
  
  Parameters
  ----------
  n_candidates : int
      Expect number of input candidates.
  n_chosen : int
      Expect numebr of inputs finally chosen.
  alpha : Tensor
      Tensor that stores the "learnable" weights.
  softmax : nn.Module
      Customizable softmax function. Usually ``nn.Softmax(-1)``.
  label : str
      Name of the choice.
class_docstr_tok: ["Mixed","input",".","Forward","returns","a","weighted","sum","of","candidates",".","Implementation","is","very","similar","to",":","class",":","`","DifferentiableMixedLayer","`",".","Parameters","--","--","--","--","--","n_candidates",":","int","Expect","number","of","input","candidates",".","n_chosen",":","int","Expect","numebr","of","inputs","finally","chosen",".","alpha",":","Tensor","Tensor","that","stores","the","``","learnable","''","weights",".","softmax",":","nn.Module","Customizable","softmax","function",".","Usually","``","nn.Softmax","(","-1",")","``",".","label",":","str","Name","of","the","choice","."]
code: def __init__(
      self,
      n_candidates: int,
      n_chosen: int | None,
      alpha: torch.Tensor,
      softmax: nn.Module,
      label: str,
  ):
      if n_chosen is None:
          warnings.warn(
              "Differentiable architecture search does not support choosing multiple inputs. Assuming one.",
              RuntimeWarning,
          )
          n_chosen = 1
      super().__init__(n_candidates, n_chosen=n_chosen, label=label)
      if len(alpha) != n_candidates:
          raise ValueError(
              f"The size of alpha ({len(alpha)}) must match number of candidates ({n_candidates})."
          )
      self._softmax = softmax
      self._arch_alpha = alpha
  
imports: from __future__ import annotations
  import functools
  import logging
  import warnings
  from typing import Any, Dict, Sequence, List, Tuple, cast
  import torch
  import torch.nn
  import torch.nn.functional
  from nni.mutable import MutableExpression, Mutable, Categorical
  from nni.nas.nn.pytorch import LayerChoice, InputChoice, Repeat
  from nni.nas.nn.pytorch.cell import preprocess_cell_inputs
  from .base import BaseSuperNetModule
  from .operation import MixedOperation, MixedOperationSamplingPolicy
  from .sampling import PathSamplingCell
  from ._expression_utils import traverse_all_options, weighted_sum
label_desc: Use image node_id 1 to create a new DifferentiableMixedInput object from inherited base classes: InputChoice, BaseSuperNetModule with example: obj = DifferentiableMixedInput(n_candidates, n_chosen, alpha, softmax, label)