code: def test_cumsum(vec) -> None:
      forward_cumsum = cumsum(mx.nd, mx.nd.array(vec)).asnumpy()
      np_forward_cumsum = np.cumsum(vec, axis=-1)
      assert np.all(forward_cumsum == np_forward_cumsum), (
          f"forward cumsum did not match: "
          f"expected: {np_forward_cumsum}, obtained: {forward_cumsum}"
      )
  
      reverse_cumsum = cumsum(
          mx.nd, mx.nd.array(vec), reverse=True
      ).asnumpy()
      np_reverse_cumsum = np.flip(
          np.cumsum(np.flip(vec, axis=-1), axis=-1), axis=-1
      )
      assert np.all(reverse_cumsum == np_reverse_cumsum), (
          f"reverse cumsum did not match: "
          f"expected: {np_reverse_cumsum}, obtained: {reverse_cumsum}"
      )
  
      forward_cumsum_excl = cumsum(
          mx.nd, mx.nd.array(vec), exclusive=True
      ).asnumpy()
      np_forward_cumsum_excl = np.insert(
          np_forward_cumsum[..., :-1], 0, 0, axis=-1
      )
      assert np.all(forward_cumsum_excl == np_forward_cumsum_excl), (
          f"forward cumsum (exclusive) did not match: "
          f"expected: {np_forward_cumsum_excl}, obtained: {forward_cumsum_excl}"
      )
  
      reverse_cumsum_excl = cumsum(
          mx.nd, mx.nd.array(vec), exclusive=True, reverse=True
      ).asnumpy()
      np_reverse_cumsum_excl = np.insert(
          np_reverse_cumsum[..., 1:], np.shape(vec)[-1] - 1, 0, axis=-1
      )
      assert np.all(reverse_cumsum_excl == np_reverse_cumsum_excl), (
          f"reverse cumsum (exclusive) did not match: "
          f"expected: {np_reverse_cumsum_excl}, obtained: {reverse_cumsum_excl}"
      )
  
file_path: gluonts/test/mx/test_mx_util.py
imports: import pytest
  import itertools
  import tempfile
  from pathlib import Path
  from typing import List
  import mxnet
  import numpy
  from gluonts.mx import Tensor
  from gluonts.mx.util import cumsum, export_symb_block, hybrid_block_to_symbol_block, import_symb_block, mx_switch, weighted_average
label_desc: Use image node_id 1 for calling a global function with example usage: test_cumsum(vec) without return types