code: def test_constrained_paths():
      for be in backends:
          for array_type in array_types:
              n, d = 10, 3
              rng = np.random.RandomState(0)
              x = cast(rng.randn(n, d), array_type)
              y = cast(rng.randn(n, d), array_type)
              dtw_sakoe = tslearn.metrics.dtw(
                  x,
                  y,
                  global_constraint="sakoe_chiba",
                  sakoe_chiba_radius=0,
                  be=be,
              )
              dtw_itak = tslearn.metrics.dtw(
                  x,
                  y,
                  global_constraint="itakura",
                  itakura_max_slope=1.0,
                  be=be,
              )
              backend = instantiate_backend(be, array_type)
              euc_dist = backend.linalg.norm(
                  backend.array(x) - backend.array(y)
              )
              np.testing.assert_allclose(dtw_sakoe, euc_dist, atol=1e-5)
              np.testing.assert_allclose(dtw_itak, euc_dist, atol=1e-5)
              backend = instantiate_backend(be, array_type)
              assert backend.is_float(dtw_sakoe)
              assert backend.is_float(dtw_itak)
  
              z = cast(rng.randn(3 * n, d), array_type)
              np.testing.assert_warns(
                  RuntimeWarning,
                  tslearn.metrics.dtw,
                  x,
                  z,
                  global_constraint="itakura",
                  itakura_max_slope=2.0,
                  be=be,
              )
              np.testing.assert_warns(
                  RuntimeWarning,
                  tslearn.metrics.dtw,
                  z,
                  x,
                  global_constraint="itakura",
                  itakura_max_slope=2.0,
                  be=be,
              )
  
imports: import platform
  import sys
  import numpy
  import pytest
  import tslearn.clustering
  import tslearn.metrics
  from scipy.spatial.distance import cdist
  from tslearn.backend.backend import Backend, cast, instantiate_backend
  from tslearn.metrics.dtw_variants import dtw_path
  from tslearn.utils import to_time_series
label_desc: Use image node_id 7 for calling a global function with example usage: test_constrained_paths() without return types