def get_persisted_value_from_ensemble(ensemble, key):
  """Return constant persisted tensor values from the previous subnetwork.

  Args:
    ensemble: Previous ensemble.
    key: Name of constant to get from eprsisted tensor.

  Returns:
    int|float value of the constant.
  """
  previous_subnetwork = ensemble.weighted_subnetworks[-1].subnetwork
  persisted_tensor = previous_subnetwork.shared[key]
  return persisted_tensor