code: def test_foreach_with_unkown_dim():
      # MXNet supports using 0 as placeholder for unknown dimensions in shape
      step = lambda data, states: (data + states[0], [states[0] * 2])
      # input shape with NCHW format and N is unknown
      data = mx.sym.var("data", shape=(0, 3, 32, 32))
      states = [mx.sym.var("state")]
      outs, states = mx.sym.contrib.foreach(step, data, states)
      _, output_shape, _ = outs.infer_shape_partial()
      assert_allclose((0, 3, 32, 32), output_shape[0])
  
file_path: mxnet/tests/python/unittest/test_contrib_control_flow.py
imports: import pytest
  import mxnet
  from numpy.testing import assert_allclose
  from mxnet.test_utils import *
  from mxnet.base import _as_list
label_desc: Use image node_id 8 for calling a global function with example usage: test_foreach_with_unkown_dim() without return types