code: def test_periodic_cumsum(period, size, left_shape, right_shape):
      dim = -1 - len(right_shape)
      tensor = torch.randn(left_shape + (size,) + right_shape)
      actual = periodic_cumsum(tensor, period, dim)
      assert actual.shape == tensor.shape
      dots = (slice(None),) * len(left_shape)
      for t in range(period):
          assert_equal(actual[dots + (t,)], tensor[dots + (t,)])
      for t in range(period, size):
          assert_close(
              actual[dots + (t,)],
              tensor[dots + (t,)] + actual[dots + (t - period,)],
          )
  
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 5 for calling a global function with example usage: test_periodic_cumsum(period, size, left_shape, right_shape) without return types