code: def test_periodic_features(duration):
      pyro.set_rng_seed(duration)
      max_period = (
          torch.distributions.Uniform(2, duration).sample().item()
      )
      for max_period in [max_period, duration]:
          min_period = (
              torch.distributions.Uniform(2, max_period).sample().item()
          )
          for min_period in [min_period, 2]:
              actual = periodic_features(
                  duration, max_period, min_period
              )
              assert actual.shape == (
                  duration,
                  2 * math.ceil(max_period / min_period) - 2,
              )
              assert (-1 <= actual).all()
              assert (actual <= 1).all()
  
imports: import math
  import numpy
  import pytest
  import scipy.fftpack
  import torch
  import pyro
  from pyro.ops.tensor_utils import block_diag_embed, block_diagonal, convolve, dct, idct, next_fast_len, periodic_cumsum, periodic_features, periodic_repeat, precision_to_scale_tril, repeated_matmul
  from tests.common import assert_close, assert_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_periodic_features(duration) without return types