code: def test_torch_trapezoid(
      dtype_y_x,
      use_x,
      dim,
      dx,
      on_device,
      fn_tree,
      frontend,
      test_flags,
      backend_fw,
  ):
      dtype, y, x = dtype_y_x
      if use_x:
          test_flags.num_positional_args = 2
          kwargs = {"y": y, "x": x, "dim": -1}
      else:
          test_flags.num_positional_args = 1
          kwargs = {"y": y, "dx": dx, "dim": dim}
      helpers.test_frontend_function(
          input_dtypes=dtype,
          backend_to_test=backend_fw,
          frontend=frontend,
          test_flags=test_flags,
          fn_tree=fn_tree,
          on_device=on_device,
          **kwargs,
      )
  
imports: import sys
  import numpy
  from hypothesis import strategies, assume
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_frontend_test
  from ivy_tests.test_ivy.test_functional.test_core.test_linalg import _matrix_rank_helper
  from ivy_tests.test_ivy.helpers.hypothesis_helpers.general_helpers import matrix_is_stable
label_desc: Use image node_id 28 for calling a global function with example usage: test_torch_trapezoid(dtype_y_x, use_x, dim, dx, on_device, fn_tree, frontend, test_flags, backend_fw) without return types