code: def test_suggest_periods(self):
      self.assertListEqual(
          [], util.suggest_periods([1 for _ in range(20)])
      )
      self.assertListEqual(
          [2.0], util.suggest_periods([i % 2 for i in range(20)])
      )
      np.testing.assert_allclose(
          [20.0],
          util.suggest_periods(
              [jnp.sin(2.0 * jnp.pi * i / 20.0) for i in range(100)]
          ),
      )
      # suggest_periods is robust against small linear trends ...
      np.testing.assert_allclose(
          [20.0],
          util.suggest_periods(
              [
                  0.01 * i + jnp.sin(2.0 * jnp.pi * i / 20.0)
                  for i in range(100)
              ]
          ),
      )
      # but sort of falls apart currently for large linear trends.
      np.testing.assert_allclose(
          [50.0, 100.0 / 3.0],
          util.suggest_periods(
              [i + jnp.sin(2.0 * jnp.pi * i / 20.0) for i in range(100)]
          ),
      )
  
file_path: probability/tensorflow_probability/python/experimental/autobnn/util_test.py
imports: import jax
  import jax.numpy
  import numpy
  from tensorflow_probability.python.experimental.autobnn import kernels
  from tensorflow_probability.python.experimental.autobnn import util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 1 for calling the UtilTest obj's underlying member method code with example usage: obj.test_suggest_periods() without return types