code: def test_2d_motion(dtype):
      # Generate synthetic data
      rng = np.random.default_rng(0)
      image0 = rng.normal(size=(256, 256))
      gt_flow, image1 = _sin_flow_gen(image0)
      image1 = image1.astype(dtype, copy=False)
      float_dtype = _supported_float_type(dtype)
      # Estimate the flow
      flow = optical_flow_tvl1(
          image0, image1, attachment=5, dtype=float_dtype
      )
      assert flow.dtype == float_dtype
      # Assert that the average absolute error is less then half a pixel
      assert abs(flow - gt_flow).mean() < 0.5
  
      if dtype != float_dtype:
          with pytest.raises(ValueError):
              optical_flow_tvl1(
                  image0, image1, attachment=5, dtype=dtype
              )
  
file_path: scikit-image/skimage/registration/tests/test_tvl1.py
imports: import numpy
  import pytest
  from skimage._shared.utils import _supported_float_type
  from skimage.registration import optical_flow_tvl1
  from skimage.transform import warp
label_desc: Use image node_id 2 for calling a global function with example usage: test_2d_motion(dtype) without return types