Skip to content

Commit

Permalink
cdist
Browse files Browse the repository at this point in the history
  • Loading branch information
teckno committed Aug 15, 2023
1 parent 9d93070 commit 3d51e16
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ivy/functional/frontends/torch/miscellaneous_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,8 @@ def corrcoef(input):
f" input with {ivy.shape(input)} dimansions"
)
return ivy.corrcoef(input, y=None, rowvar=True)

@to_ivy_arrays_and_back
def cdist(x1, x2, p=2.0, compute_mode='use_mm_for_euclid_dist_if_necessary'):
return ivy.cdist(x1, x2, p=p, compute_mode=compute_mode)

Original file line number Diff line number Diff line change
Expand Up @@ -1655,3 +1655,36 @@ def test_torch_corrcoef(
backend_to_test=backend_fw,
input=x[0],
)

# corrcoef
@handle_frontend_test(
fn_tree="torch.cdist",
dtypes_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
num_arrays=1,
min_num_dims=2,
max_num_dims=2,
min_dim_size=2,
max_dim_size=2,
min_value=1,
),
test_with_out=st.just(False),
)
def test_torch_cdist(
dtypes_and_x,
frontend,
fn_tree,
on_device,
test_flags,
backend_fw,
):
input_dtypes, x = dtypes_and_x
helpers.test_frontend_function(
input_dtypes=["float64"],
frontend=frontend,
fn_tree=fn_tree,
test_flags=test_flags,
on_device=on_device,
backend_to_test=backend_fw,
input=x[0],
)

0 comments on commit 3d51e16

Please sign in to comment.