code: def cdist(
      x1, x2, p=2.0, compute_mode="use_mm_for_euclid_dist_if_necessary"
  ):
      if len(x1.shape) == 2 and len(x2.shape) == 2:
          x1_first_dim, x2_first_dim = x1.shape[0], x2.shape[0]
          if (
              compute_mode == "use_mm_for_euclid_dist_if_necessary"
              and (x1_first_dim > 25 or x2_first_dim > 25)
              or compute_mode == "use_mm_for_euclid_dist"
          ):
              return ivy.vector_norm(
                  x1[:, None, :] - x2[None, :, :], axis=-1, ord=p
              )
          else:
              distances = ivy.zeros(
                  (x1_first_dim, x2_first_dim), dtype=x1.dtype
              )
              for i in range(x1_first_dim):
                  for j in range(x2_first_dim):
                      distances[i, j] = ivy.vector_norm(
                          x1[i, :] - x2[j, :], ord=p
                      )
              return distances
      if p == 2:
          B, P, M = x1.shape
          _, R, _ = x2.shape
          if (
              compute_mode == "use_mm_for_euclid_dist_if_necessary"
              and (P > 25 or R > 25)
              or compute_mode == "use_mm_for_euclid_dist"
          ):
              return ivy.vector_norm(
                  x1[:, :, None, :] - x2[:, None, :, :], axis=-1, ord=p
              )
          else:
              distances = ivy.zeros((B, P, R), dtype=x1.dtype)
              for b in range(B):
                  for i in range(P):
                      for j in range(R):
                          distances[b, i, j] = ivy.vector_norm(
                              x1[b, i, :] - x2[b, j, :], ord=p
                          )
              return distances
      else:
          return ivy.vector_norm(
              x1[:, :, None, :] - x2[:, None, :, :], axis=-1, ord=p
          )
  
imports: import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
  from ivy.functional.frontends.torch import promote_types_of_torch_inputs
  import ivy.functional.frontends.torch
label_desc: Use image node_id 8 for calling a global function with example usage: cdist(x1, x2, p, compute_mode) and returns: ivy, ivy, distances, ivy, distances