# Path: tensorflow_lattice/python/utils.py
# def canonicalize_convexity(convexity):
# def canonicalize_input_bounds(input_bounds):
# def canonicalize_monotonicity(monotonicity, allow_decreasing=True):
# def canonicalize_monotonicities(monotonicities, allow_decreasing=True):
# def canonicalize_trust(trusts):
# def canonicalize_unimodalities(unimodalities):
# def count_non_zeros(*iterables):


from absl.testing import parameterized
from tensorflow_lattice.python import utils
import tensorflow as tf
    canonicalized_monotonicity = utils.canonicalize_monotonicity(monotonicity)
    self.assertEqual(canonicalized_monotonicity,
                     expected_canonicalized_monotonicity)

  @parameterized.parameters((-2), (0.5), (3), ("invalid_monotonicity"),
                            ("decrease"), ("increase"))
  def testInvalidMonotonicity(self, invalid_monotonicity):
    error_message = (
        "'monotonicities' must be from: [-1, 0, 1, 'decreasing', 'none', "
        "'increasing']. Given: {}").format(invalid_monotonicity)
    with self.assertRaisesWithLiteralMatch(ValueError, error_message):
      utils.canonicalize_monotonicity(invalid_monotonicity)

  @parameterized.parameters(("decreasing"), (-1))
  def testInvalidDecreasingMonotonicity(self, invalid_monotonicity):
    error_message = (
        "'monotonicities' must be from: [0, 1, 'none', 'increasing']. "
        "Given: {}").format(invalid_monotonicity)
    with self.assertRaisesWithLiteralMatch(ValueError, error_message):
      utils.canonicalize_monotonicity(
          invalid_monotonicity, allow_decreasing=False)

  # Note: since canonicalize_monotonicities calls canonicalize_monotonicity,
  # the above test for invalidity is sufficient.
  @parameterized.parameters(([-1, 0, 1], [-1, 0, 1]),
                            (["decreasing", "none", "increasing"], [-1, 0, 1]),
                            (["decreasing", -1], [-1, -1]),
                            (["none", 0], [0, 0]), (["increasing", 1], [1, 1]))
  def testCanonicalizeMonotonicities(self, monotonicities,
                                     expected_canonicalized_monotonicities):

# Path: tensorflow_lattice/python/utils.py
# def canonicalize_convexity(convexity):
# def canonicalize_input_bounds(input_bounds):
# def canonicalize_monotonicity(monotonicity, allow_decreasing=True):
# def canonicalize_monotonicities(monotonicities, allow_decreasing=True):
# def canonicalize_trust(trusts):
# def canonicalize_unimodalities(unimodalities):
# def count_non_zeros(*iterables):


# Path: tensorflow_lattice/python/utils_test.py
from absl.testing import parameterized
from tensorflow_lattice.python import utils
import tensorflow as tf

    canonicalized_monotonicity = utils.canonicalize_monotonicity(monotonicity)
    self.assertEqual(canonicalized_monotonicity,
                     expected_canonicalized_monotonicity)

  @parameterized.parameters((-2), (0.5), (3), ("invalid_monotonicity"),
                            ("decrease"), ("increase"))
  def testInvalidMonotonicity(self, invalid_monotonicity):
    error_message = (
        "'monotonicities' must be from: [-1, 0, 1, 'decreasing', 'none', "
        "'increasing']. Given: {}").format(invalid_monotonicity)
    with self.assertRaisesWithLiteralMatch(ValueError, error_message):
      utils.canonicalize_monotonicity(invalid_monotonicity)

  @parameterized.parameters(("decreasing"), (-1))
  def testInvalidDecreasingMonotonicity(self, invalid_monotonicity):
    error_message = (
        "'monotonicities' must be from: [0, 1, 'none', 'increasing']. "
        "Given: {}").format(invalid_monotonicity)
    with self.assertRaisesWithLiteralMatch(ValueError, error_message):
      utils.canonicalize_monotonicity(
          invalid_monotonicity, allow_decreasing=False)

  # Note: since canonicalize_monotonicities calls canonicalize_monotonicity,
  # the above test for invalidity is sufficient.
  @parameterized.parameters(([-1, 0, 1], [-1, 0, 1]),
                            (["decreasing", "none", "increasing"], [-1, 0, 1]),
                            (["decreasing", -1], [-1, -1]),
                            (["none", 0], [0, 0]), (["increasing", 1], [1, 1]))
  def testCanonicalizeMonotonicities(self, monotonicities,
                                     expected_canonicalized_monotonicities):

    canonicalized_monotonicities = utils.canonicalize_monotonicities(