code: def test_to_sequence_basic(device_id):
      dev = cntk_device(device_id)
      x = C.input_variable((C.FreeDimension, 2))
      x_seq = C.to_sequence(x)
      assert len(x_seq.dynamic_axes) == 2
  
      x_data = np.asarray(
          [[[1, 2], [-1000, -1000]], [[3, 4], [5, 6]]], dtype=np.float32
      )
      result = x_seq.eval({x: x_data}, device=dev)
      assert np.array_equal(result, x_data)
  
      x = C.input_variable((C.FreeDimension, 2, 3), is_sparse=True)
      x_seq_lens = C.input_variable(())
      x_seq = C.to_sequence(x, x_seq_lens)
  
      seq1_data = [[[0, 1, 1], [0, 1, 0]], [[1, 0, 0], [1, 0, 1]]]
      csr_seq1 = _to_csr(seq1_data)
      ndarrayview1 = C.NDArrayView.from_csr(
          csr_seq1, shape=(2, 2, 3), device=C.cpu()
      )
      seq2_data = [[0, 1, 1], [1, 1, 0]]
      csr_seq2 = _to_csr([seq2_data, [[0, 0, 0], [0, 0, 0]]])
      ndarrayview2 = C.NDArrayView.from_csr(
          csr_seq2, shape=(2, 2, 3), device=C.cpu()
      )
  
      x_data = C.Value.create(
          C.input_variable((2, 2, 3), is_sparse=True),
          [ndarrayview1, ndarrayview2],
          device=dev,
      ).data
      x_seq_lens_data = np.asarray([2, 1], dtype=np.float32)
      result = x_seq.eval(
          {x: x_data, x_seq_lens: x_seq_lens_data},
          device=dev,
          as_numpy=False,
      )
      result_dense = _to_dense(result, True)
      assert np.array_equal(result_dense[0], seq1_data)
      assert np.array_equal(result_dense[1], [seq2_data])
  
imports: from __future__ import division
  import numpy
  import pytest
  import cntk
  from .ops_test_utils import cntk_device
  from cntk.tests.test_utils import _to_dense, _to_csr
  from .ops_test_utils import unittest_helper, _test_unary_op, _test_binary_op, AA, precision, PRECISION_TO_TYPE, cntk_device
  from cntk import Value
  from cntk.axis import Axis
  from cntk.internal import sanitize_dtype_cntk
  from ..None import constant
label_desc: Use image node_id 11 for calling a global function with example usage: test_to_sequence_basic(device_id) without return types