code: def make_sum_of_operators_of_relaxed_leaves(
      time_series_xs: Array,
      width: int = 5,
      periods: Sequence[float] = (0.1,),
      use_mul: bool = True,
      num_outputs: int = 1,
  ) -> bnn.BNN:
      """Returns BNN model consisting of a sum of products or changeponts of leaves.
  
      Each leaf is a continuous relaxation over base kernels.
  
      Args:
        time_series_xs: The x-values of the training data.
        width: Width of the leaf BNNs.
        periods: Periods for the PeriodicBNN kernel.
        use_mul: If true, use Multiply as the depth 1 operator.  If false, use
          a LearnableChangepoint instead.
        num_outputs: Number of outputs on the BNN.
      """
      del num_outputs
  
      def _make_continuous_relaxation(
          width: int,
          periods: Sequence[float],
          include_eq_and_poly: bool,
      ) -> bnn.BNN:
          leaves = [
              kernels.PeriodicBNN(
                  width=width, period=p, going_to_be_multiplied=use_mul
              )
              for p in periods
          ]
          leaves.append(
              kernels.LinearBNN(
                  width=width, going_to_be_multiplied=use_mul
              )
          )
          if include_eq_and_poly:
              leaves.extend(
                  [
                      kernels.ExponentiatedQuadraticBNN(
                          width=width, going_to_be_multiplied=use_mul
                      ),
                      kernels.PolynomialBNN(
                          width=width, going_to_be_multiplied=use_mul
                      ),
                      kernels.IdentityBNN(
                          width=width, going_to_be_multiplied=use_mul
                      ),
                  ]
              )
          return operators.WeightedSum(
              bnns=tuple(leaves),
              num_outputs=1,
              going_to_be_multiplied=use_mul,
          )
  
      leaf1 = _make_continuous_relaxation(
          width, periods, include_eq_and_poly=False
      )
      leaf2 = _make_continuous_relaxation(
          width, periods, include_eq_and_poly=False
      )
  
      if use_mul:
          op = operators.Multiply
      else:
          op = functools.partial(
              operators.LearnableChangePoint,
              time_series_xs=time_series_xs,
          )
  
      bnn1 = op(bnns=(leaf1, leaf2))
  
      leaf3 = _make_continuous_relaxation(
          width, periods, include_eq_and_poly=True
      )
      leaf4 = _make_continuous_relaxation(
          width, periods, include_eq_and_poly=True
      )
      bnn2 = op(bnns=(leaf3, leaf4))
  
      net = operators.Add(bnns=(bnn1, bnn2))
      return net
  
file_path: probability/tensorflow_probability/python/experimental/autobnn/models.py
imports: import functools
  from typing import Sequence
  import jax.numpy
  from tensorflow_probability.python.experimental.autobnn import bnn
  from tensorflow_probability.python.experimental.autobnn import bnn_tree
  from tensorflow_probability.python.experimental.autobnn import kernels
  from tensorflow_probability.python.experimental.autobnn import likelihoods
  from tensorflow_probability.python.experimental.autobnn import operators
label_desc: Use image node_id 1 for calling a global function with example usage: make_sum_of_operators_of_relaxed_leaves(time_series_xs, width, periods, use_mul, num_outputs) and returns: net, operators