code: def test_conv_with_freedim_model(tmpdir, dtype, device_id):
      pytest.skip(
          "Needs to be fixed after removal of batch axis change."
      )
      if device_id == -1 and dtype == np.float16:
          pytest.skip("Test only runs on GPU")
      device = cntk_device(device_id)
      with C.default_options(dtype=dtype):
          img_shape = (3, 32, 32)
          img = np.asarray(
              np.random.uniform(-1, 1, img_shape), dtype=dtype
          )
  
          x = C.input_variable((3, C.FreeDimension, C.FreeDimension))
  
          conv_size1 = (32, 3, 5, 5)
          conv_map1 = C.constant(
              value=np.arange(np.prod(conv_size1), dtype=dtype).reshape(
                  conv_size1
              )
          )
          conv_op1 = C.convolution(
              conv_map1, x, auto_padding=(False, True, True)
          )
          relu_op1 = C.relu(conv_op1)
          maxpool_op1 = C.pooling(
              relu_op1, C.MAX_POOLING, (2, 2), (2, 2)
          )
  
          conv_size2 = (64, 32, 3, 3)
          conv_map2 = C.constant(
              value=np.arange(np.prod(conv_size2), dtype=dtype).reshape(
                  conv_size2
              )
          )
          conv_op2 = C.convolution(
              conv_map2, maxpool_op1, auto_padding=(False, True, True)
          )
          relu_op2 = C.relu(conv_op2)
          root_node = C.pooling(relu_op2, C.MAX_POOLING, (2, 2), (2, 2))
  
          filename = os.path.join(
              str(tmpdir), R"conv_with_freedim.onnx"
          )
          root_node.save(filename, format=C.ModelFormat.ONNX)
  
          loaded_node = C.Function.load(
              filename, format=C.ModelFormat.ONNX
          )
          assert root_node.shape == loaded_node.shape
  
          x_ = loaded_node.arguments[0]
          assert np.allclose(
              loaded_node.eval({x_: img}, device=device),
              root_node.eval({x: img}, device=device),
          )
  
          # Additional test to ensure that loaded_node can be saved as both ONNX and CNTKv2 again.
          filename2 = os.path.join(
              str(tmpdir), R"conv_with_freedim2.onnx"
          )
          loaded_node.save(filename2, format=C.ModelFormat.ONNX)
  
          filename3 = os.path.join(
              str(tmpdir), R"conv_with_freedim2.cntkmodel"
          )
          loaded_node.save(filename3, format=C.ModelFormat.CNTKv2)
  
file_path: CNTK/bindings/python/cntk/tests/onnx_format_test.py
imports: import os
  import numpy
  import cntk
  from cntk.ops.tests.ops_test_utils import cntk_device
  import pytest
label_desc: Use image node_id 11 for calling a global function with example usage: test_conv_with_freedim_model(tmpdir, dtype, device_id) without return types