class_docstr: The AdaNet algorithm implemented as an :class:`adanet.ensemble.Ensembler`.
  
  The AdaNet algorithm was introduced in the [Cortes et al. ICML 2017] paper:
  https://arxiv.org/abs/1607.01097.
  
  The AdaNet algorithm uses a weak learning algorithm to iteratively generate a
  set of candidate subnetworks that attempt to minimize the loss function
  defined in Equation (4) as part of an ensemble. At the end of each iteration,
  the best candidate is chosen based on its ensemble's complexity-regularized
  train loss. New subnetworks are allowed to use any subnetwork weights within
  the previous iteration's ensemble in order to improve upon them. If the
  complexity-regularized loss of the new ensemble, as defined in Equation (4),
  is less than that of the previous iteration's ensemble, the AdaNet algorithm
  continues onto the next iteration.
  
  AdaNet attempts to minimize the following loss function to learn the mixture
  weights :math:`w` of each subnetwork :math:`h` in the ensemble with
  differentiable convex non-increasing surrogate loss function :math:`\Phi`:
  
  Equation (4):
  
  .. math::
  
      F(w) = \frac{1}{m} \sum_{i=1}^{m} \Phi \left(\sum_{j=1}^{N}w_jh_j(x_i),
      y_i \right) + \sum_{j=1}^{N} \left(\lambda r(h_j) + \beta \right) |w_j|
  
  with :math:`\lambda >= 0` and :math:`\beta >= 0`.
  
  Args:
    optimizer: String, :class:`tf.train.Optimizer` object, or callable that
      creates the optimizer to use for training the ensemble weights. If left
      as :code:`None`, :meth:`tf.no_op()` is used instead.
    mixture_weight_type: The :class:`adanet.ensemble.MixtureWeightType` defining
      which mixture weight type to learn on top of the subnetworks' logits.
    mixture_weight_initializer: The initializer for mixture_weights. When
      :code:`None`, the default is different according to
      :code:`mixture_weight_type`:
  
        - :code:`SCALAR` initializes to :math:`1/N` where :math:`N` is the
          number of subnetworks in the ensemble giving a uniform average.
        - :code:`VECTOR` initializes each entry to :math:`1/N` where :math:`N`
          is the number of subnetworks in the ensemble giving a uniform average.
        - :code:`MATRIX` uses :meth:`tf.zeros_initializer`.
    warm_start_mixture_weights: Whether, at the beginning of an iteration, to
      initialize the mixture weights of the subnetworks from the previous
      ensemble to their learned value at the previous iteration, as opposed to
      retraining them from scratch. Takes precedence over the value for
      :code:`mixture_weight_initializer` for subnetworks from previous
      iterations.
    model_dir: The model dir to use for warm-starting mixture weights and bias
      at the logit layer. Ignored if :code:`warm_start_mixture_weights` is
      :code:`False`.
    adanet_lambda: Float multiplier :math:`\lambda` for applying :math:`L1`
      regularization to subnetworks' mixture weights :math:`w` in the ensemble
      proportional to their complexity. See Equation (4) in the AdaNet paper.
    adanet_beta: Float :math:`L1` regularization multiplier :math:`\beta` to apply
      equally to all subnetworks' weights :math:`w` in the ensemble regardless of
      their complexity. See Equation (4) in the AdaNet paper.
    use_bias: Whether to add a bias term to the ensemble's logits.
    name: Optional name for the ensembler. Defaults to 'complexity_regularized'.
  
  Returns:
    An `adanet.ensemble.ComplexityRegularizedEnsembler` instance.
  
  Raises:
    ValueError: if :code:`warm_start_mixture_weights` is :code:`True` but
    :code:`model_dir` is :code:`None`.
docstr: For a subnetwork, computes: (lambda * r(h) + beta) * |w|.
docstr_tok: ["For","a","subnetwork",",","computes",":","(","lambda","*","r","(","h",")","+","beta",")","*","|w|","."]
code: def _compute_complexity_regularization_helper(
      self, weight_l1_norm, complexity
  ):
      """For a subnetwork, computes: (lambda * r(h) + beta) * |w|."""
  
      # Note: Unsafe comparison against float zero.
      if self._adanet_lambda == 0.0 and self._adanet_beta == 0.0:
          return tf.constant(0.0, name="zero")
      return tf.scalar_mul(
          self._compute_adanet_gamma(complexity), weight_l1_norm
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from absl import logging
  from adanet import tf_compat
  from adanet.ensemble.ensembler import Ensemble
  from adanet.ensemble.ensembler import Ensembler
  import tensorflow.compat.v2
label_desc: Use image node_id 14 for calling the ComplexityRegularizedEnsembler obj's underlying member method code with example usage: obj._compute_complexity_regularization_helper(weight_l1_norm, complexity) and returns: tf, tf