From fdd7e00216e0271013703c2a11b666cb5c2c4fc9 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:11:49 +0100 Subject: [PATCH 01/14] Update torch frontend tensor.svd's accepted dtypes --- ivy/functional/frontends/torch/tensor.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ivy/functional/frontends/torch/tensor.py b/ivy/functional/frontends/torch/tensor.py index ef09a2942b1d..0e74da12de75 100644 --- a/ivy/functional/frontends/torch/tensor.py +++ b/ivy/functional/frontends/torch/tensor.py @@ -2109,7 +2109,19 @@ def adjoint(self): def conj(self): return torch_frontend.conj(self) - @with_unsupported_dtypes({"2.2 and below": ("float16", "bfloat16")}, "torch") + @with_supported_dtypes( + { + "2.2 and below": ( + "float64", + "float32", + "half", + "complex32", + "complex64", + "complex128", + ) + }, + "torch", + ) def svd(self, some=True, compute_uv=True, *, out=None): return torch_frontend.svd(self, some=some, compute_uv=compute_uv, out=out) From cd0d95d6a9ac2a5bef9bab1f3fd23a11083a16b0 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:14:03 +0100 Subject: [PATCH 02/14] fixed torch frontend linalg.svd update accepted dtype to include complex numbers add handling for out argument fix dtype and output format --- ivy/functional/frontends/torch/linalg.py | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/ivy/functional/frontends/torch/linalg.py b/ivy/functional/frontends/torch/linalg.py index 0174959d032b..ad951346831d 100644 --- a/ivy/functional/frontends/torch/linalg.py +++ b/ivy/functional/frontends/torch/linalg.py @@ -347,11 +347,30 @@ def solve_ex(A, B, *, left=True, check_errors=False, out=None): @to_ivy_arrays_and_back @with_supported_dtypes( - {"2.2 and below": ("float32", "float64", "complex32", "complex64")}, "torch" + { + "2.2 and below": ( + "float64", + "float32", + "half", + "complex32", + "complex64", + "complex128", + ) + }, + "torch", ) def svd(A, /, *, full_matrices=True, driver=None, out=None): - # TODO: add handling for driver and out - return ivy.svd(A, compute_uv=True, full_matrices=full_matrices) + # TODO: add handling for driver + USVh = ivy.svd(A, compute_uv=True, full_matrices=full_matrices) + if ivy.is_complex_dtype(A.dtype): + d = ivy.complex64 + else: + d = ivy.float32 + nt = namedtuple("svd", "U S Vh") + ret = nt(ivy.astype(USVh.U, d), ivy.astype(USVh.S, d), ivy.astype(USVh.Vh, d)) + if ivy.exists(out): + return ivy.inplace_update(out, ret) + return ret @to_ivy_arrays_and_back From 3b41260f71befa4aa900e1c5d176fa65abf0d9d7 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:16:13 +0100 Subject: [PATCH 03/14] fixed torch frontend blas_and_lapack_ops.svd added its accepted dtypes add handling to compute_uv argument fix output format --- .../frontends/torch/blas_and_lapack_ops.py | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/ivy/functional/frontends/torch/blas_and_lapack_ops.py b/ivy/functional/frontends/torch/blas_and_lapack_ops.py index a1c8cd9bbe77..cd2da01ec727 100644 --- a/ivy/functional/frontends/torch/blas_and_lapack_ops.py +++ b/ivy/functional/frontends/torch/blas_and_lapack_ops.py @@ -190,12 +190,35 @@ def slogdet(A, *, out=None): @to_ivy_arrays_and_back +@with_supported_dtypes( + { + "2.2 and below": ( + "float64", + "float32", + "half", + "complex32", + "complex64", + "complex128", + ) + }, + "torch", +) def svd(input, some=True, compute_uv=True, *, out=None): - # TODO: add compute_uv - if some: - ret = ivy.svd(input, full_matrices=False) + retu = ivy.svd(input, full_matrices=not some, compute_uv=compute_uv) + results = namedtuple("svd", "U S V") + if compute_uv: + ret = results(retu[0], retu[1], ivy.adjoint(retu[2])) else: - ret = ivy.svd(input, full_matrices=True) + shape = list(input.shape) + shape1 = shape + shape2 = shape + shape1[-2] = shape[-1] + shape2[-1] = shape[-2] + ret = results( + ivy.zeros(shape1, device=input.device, dtype=input.dtype), + ivy.astype(retu[0], input.dtype), + ivy.zeros(shape2, device=input.device, dtype=input.dtype), + ) if ivy.exists(out): return ivy.inplace_update(out, ret) return ret From 41a08e62aa84c58a104e7d41b520c3641f48b7a7 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:18:02 +0100 Subject: [PATCH 04/14] Update linear_algebra.svd's docstring about its special return format --- ivy/functional/ivy/linear_algebra.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ivy/functional/ivy/linear_algebra.py b/ivy/functional/ivy/linear_algebra.py index 4c61f9fdbbaa..2440918e7193 100644 --- a/ivy/functional/ivy/linear_algebra.py +++ b/ivy/functional/ivy/linear_algebra.py @@ -2130,15 +2130,12 @@ def svd( If ``True`` then left and right singular vectors will be computed and returned in ``U`` and ``Vh``, respectively. Otherwise, only the singular values will be computed, which can be significantly faster. - .. note:: - with backend set as torch, svd with still compute left and right singular - vectors irrespective of the value of compute_uv, however Ivy will still - only return the singular values. Returns ------- .. note:: once complex numbers are supported, each square matrix must be Hermitian. + In addition, the return will be a namedtuple ``(S)`` when compute_uv is ``False``. ret a namedtuple ``(U, S, Vh)`` whose From 1ac3b49e9fb738a1112d1eb8fed65ed46d53c685 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:19:59 +0100 Subject: [PATCH 05/14] Update torch backend linear_algebra.svd to save some computation --- ivy/functional/backends/torch/linear_algebra.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ivy/functional/backends/torch/linear_algebra.py b/ivy/functional/backends/torch/linear_algebra.py index e8d960d313b3..9b708e697a26 100644 --- a/ivy/functional/backends/torch/linear_algebra.py +++ b/ivy/functional/backends/torch/linear_algebra.py @@ -415,15 +415,12 @@ def svd( ) -> Union[torch.Tensor, Tuple[torch.Tensor, ...]]: if compute_uv: results = namedtuple("svd", "U S Vh") - U, D, VT = torch.linalg.svd(x, full_matrices=full_matrices) return results(U, D, VT) else: results = namedtuple("svd", "S") - svd = torch.linalg.svd(x, full_matrices=full_matrices) - # torch.linalg.svd returns a tuple with U, S, and Vh - D = svd[1] - return results(D) + s = torch.linalg.svdvals(x) + return results(s) @with_unsupported_dtypes({"2.2 and below": ("float16", "bfloat16")}, backend_version) From 55875547e05f8739300f59c1db312c5d9f6dbdb4 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:21:33 +0100 Subject: [PATCH 06/14] remove unnecessary line from tensorflow backend linear_alegbra.svd --- ivy/functional/backends/tensorflow/linear_algebra.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ivy/functional/backends/tensorflow/linear_algebra.py b/ivy/functional/backends/tensorflow/linear_algebra.py index 0fcaa349572e..d1b5ed36872d 100644 --- a/ivy/functional/backends/tensorflow/linear_algebra.py +++ b/ivy/functional/backends/tensorflow/linear_algebra.py @@ -535,7 +535,6 @@ def svd( ) -> Union[Union[tf.Tensor, tf.Variable], Tuple[Union[tf.Tensor, tf.Variable], ...]]: if compute_uv: results = namedtuple("svd", "U S Vh") - batch_shape = tf.shape(x)[:-2] num_batch_dims = len(batch_shape) transpose_dims = list(range(num_batch_dims)) + [ From 36d219066817fbad4970f248c105dba9aa3aab17 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:28:58 +0100 Subject: [PATCH 07/14] fixed torch frontend test_blas_and_lapack_ops.test_torch_svd fixed testing dtype range making input symmetric positive definite matrix conduct calculation value test externally as the results are supposed to be not unique --- .../test_torch/test_blas_and_lapack_ops.py | 64 +++++++++++++++---- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py index f66853869c8e..2536af1c4e7a 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py @@ -848,37 +848,75 @@ def test_torch_qr( @handle_frontend_test( fn_tree="torch.svd", dtype_and_x=helpers.dtype_and_values( - available_dtypes=helpers.get_dtypes("float", index=1), - min_num_dims=3, - max_num_dims=5, - min_dim_size=2, - max_dim_size=5, + available_dtypes=helpers.get_dtypes("valid"), + min_value=0, + max_value=10, + shape=helpers.ints(min_value=2, max_value=5).map(lambda x: (x, x)), ), some=st.booleans(), - compute=st.booleans(), + compute_uv=st.booleans(), ) def test_torch_svd( dtype_and_x, some, - compute, + compute_uv, on_device, fn_tree, frontend, test_flags, backend_fw, ): - dtype, x = dtype_and_x - helpers.test_frontend_function( - input_dtypes=dtype, + input_dtype, x = dtype_and_x + x = np.asarray(x[0], dtype=input_dtype[0]) + # make symmetric positive definite + x = np.matmul(x.T, x) + np.identity(x.shape[0]) * 1e-3 + ret, frontend_ret = helpers.test_frontend_function( + input_dtypes=input_dtype, backend_to_test=backend_fw, frontend=frontend, test_flags=test_flags, fn_tree=fn_tree, on_device=on_device, - input=x[0], + test_values=False, + input=x, some=some, - compute_uv=compute, - ) + compute_uv=compute_uv, + ) + if backend_fw == "torch": + frontend_ret = [x.detach() for x in frontend_ret] + ret = [x.detach() for x in ret] + ret = [np.asarray(x) for x in ret] + frontend_ret = [ + np.asarray(x.resolve_conj()).astype(input_dtype[0]) for x in frontend_ret + ] + u, s, v = ret + frontend_u, frontend_s, frontend_v = frontend_ret + if not compute_uv: + helpers.assert_all_close( + ret_np=frontend_s, + ret_from_gt_np=s, + atol=1e-04, + backend=backend_fw, + ground_truth_backend=frontend, + ) + elif not some: + helpers.assert_all_close( + ret_np=frontend_u @ np.diag(frontend_s) @ frontend_v.T, + ret_from_gt_np=u @ np.diag(s) @ v.T, + atol=1e-04, + backend=backend_fw, + ground_truth_backend=frontend, + ) + else: + helpers.assert_all_close( + ret_np=frontend_u[..., : frontend_s.shape[0]] + @ np.diag(frontend_s) + @ frontend_v.T, + ret_from_gt_np=u[..., : s.shape[0]] @ np.diag(s) @ v.T, + atol=1e-04, + backend=backend_fw, + ground_truth_backend=frontend, + ) @handle_frontend_test( From 65c75aa96d2560479c5295f5a3882e2a2dd405ac Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:33:48 +0100 Subject: [PATCH 08/14] fix torch frontend test_linalg.test_torch_svd generate symmetric positive definite input matrixes with correct dtype range to be tested add different test value methods for different output modes (full_matrices) --- .../test_frontends/test_torch/test_linalg.py | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py index cda403aa5309..f6081da9c2c3 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py @@ -1242,7 +1242,12 @@ def test_torch_solve_ex( # svd @handle_frontend_test( fn_tree="torch.linalg.svd", - dtype_and_x=_get_dtype_and_matrix(square=True), + dtype_and_x=helpers.dtype_and_values( + available_dtypes=helpers.get_dtypes("valid"), + min_value=0, + max_value=10, + shape=helpers.ints(min_value=2, max_value=5).map(lambda x: (x, x)), + ), full_matrices=st.booleans(), ) def test_torch_svd( @@ -1257,7 +1262,7 @@ def test_torch_svd( ): dtype, x = dtype_and_x x = np.asarray(x[0], dtype=dtype[0]) - # make symmetric positive definite beforehand + # make symmetric positive definite x = np.matmul(x.T, x) + np.identity(x.shape[0]) * 1e-3 ret, frontend_ret = helpers.test_frontend_function( input_dtypes=dtype, @@ -1267,25 +1272,36 @@ def test_torch_svd( fn_tree=fn_tree, on_device=on_device, test_values=False, - atol=1e-03, - rtol=1e-05, A=x, full_matrices=full_matrices, ) - ret = [ivy.to_numpy(x) for x in ret] + if backend_fw == "torch": + frontend_ret = [x.detach() for x in frontend_ret] + ret = [x.detach() for x in ret] + ret = [np.asarray(x) for x in ret] frontend_ret = [np.asarray(x) for x in frontend_ret] - u, s, vh = ret frontend_u, frontend_s, frontend_vh = frontend_ret - - assert_all_close( - ret_np=u @ np.diag(s) @ vh, - ret_from_gt_np=frontend_u @ np.diag(frontend_s) @ frontend_vh, - rtol=1e-2, - atol=1e-2, - ground_truth_backend=frontend, - backend=backend_fw, - ) + if full_matrices: + helpers.assert_all_close( + ret_np=( + frontend_u[..., : frontend_s.shape[0]] + @ np.diag(frontend_s) + @ frontend_vh + ).astype(d), + ret_from_gt_np=u[..., : s.shape[0]] @ np.diag(s) @ vh, + atol=1e-04, + backend=backend_fw, + ground_truth_backend=frontend, + ) + else: + helpers.assert_all_close( + ret_np=(frontend_u @ np.diag(frontend_s) @ frontend_vh).astype(d), + ret_from_gt_np=u @ np.diag(s) @ vh, + atol=1e-04, + backend=backend_fw, + ground_truth_backend=frontend, + ) # svdvals From 6a39104f51dcede3cf17a27229d67679d42fefea Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:39:12 +0100 Subject: [PATCH 09/14] fix torch frontend test_tensor.test_torch_svd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test for all valid input dtypes make input symmetric positive-definite matrix add different value tests for different “some” argument values --- .../test_frontends/test_torch/test_tensor.py | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py index 1b4c8080695b..a43305083cb9 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py @@ -13095,13 +13095,13 @@ def test_torch_sum( on_device=on_device, ) - +# svd @handle_frontend_method( class_tree=CLASS_TREE, init_tree="torch.tensor", method_name="svd", dtype_and_x=helpers.dtype_and_values( - available_dtypes=helpers.get_dtypes("float"), + available_dtypes=helpers.get_dtypes("valid"), min_value=0, max_value=10, shape=helpers.ints(min_value=2, max_value=5).map(lambda x: (x, x)), @@ -13122,7 +13122,8 @@ def test_torch_svd( ): input_dtype, x = dtype_and_x x = np.asarray(x[0], dtype=input_dtype[0]) - + # make symmetric positive-definite + x = np.matmul(x.T, x) + np.identity(x.shape[0]) * 1e-3 ret, frontend_ret = helpers.test_frontend_method( init_input_dtypes=input_dtype, init_all_as_kwargs_np={ @@ -13141,28 +13142,33 @@ def test_torch_svd( on_device=on_device, test_values=False, ) - with helpers.update_backend(backend_fw) as ivy_backend: - ret = [ivy_backend.to_numpy(x) for x in ret] - frontend_ret = [np.asarray(x) for x in frontend_ret] - - u, s, vh = ret - frontend_u, frontend_s, frontend_vh = frontend_ret - - if compute_uv: + ret = [np.asarray(x) for x in ret] + frontend_ret = [np.asarray(x.resolve_conj()) for x in frontend_ret] + u, s, v = ret + frontend_u, frontend_s, frontend_v = frontend_ret + if not compute_uv: helpers.assert_all_close( - ret_np=frontend_u @ np.diag(frontend_s) @ frontend_vh.T, - ret_from_gt_np=u @ np.diag(s) @ vh, - rtol=1e-2, - atol=1e-2, + ret_np=frontend_s + ret_from_gt_np=s, + atol=1e-04, + backend=backend_fw, + ground_truth_backend=frontend, + ) + elif not some: + helpers.assert_all_close( + ret_np=frontend_u @ np.diag(frontend_s) @ frontend_v.T, + ret_from_gt_np=u @ np.diag(s) @ v.T, + atol=1e-04, backend=backend_fw, ground_truth_backend=frontend, ) else: helpers.assert_all_close( - ret_np=frontend_s, - ret_from_gt_np=s, - rtol=1e-2, - atol=1e-2, + ret_np=frontend_u[..., : frontend_s.shape[0]] + @ np.diag(frontend_s) + @ frontend_v.T, + ret_from_gt_np=u[..., : s.shape[0]] @ np.diag(s) @ v.T, + atol=1e-04, backend=backend_fw, ground_truth_backend=frontend, ) From 12217c740a5cf83aaa1ff6c8f2cc816524d030fd Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:42:14 +0100 Subject: [PATCH 10/14] small fix of test_torch.test_blas_and_lapack_ops.test_torch_svd --- .../test_frontends/test_torch/test_blas_and_lapack_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py index 2536af1c4e7a..2714fbfe7899 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_blas_and_lapack_ops.py @@ -887,7 +887,7 @@ def test_torch_svd( ret = [x.detach() for x in ret] ret = [np.asarray(x) for x in ret] frontend_ret = [ - np.asarray(x.resolve_conj()).astype(input_dtype[0]) for x in frontend_ret + np.asarray(x.resolve_conj()) for x in frontend_ret ] u, s, v = ret frontend_u, frontend_s, frontend_v = frontend_ret From 5c70d124d8cc89ab2337ca817c0b8f7b914f66ad Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:45:07 +0100 Subject: [PATCH 11/14] Update test_linalg.py --- ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py index f6081da9c2c3..98386135334a 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py @@ -1288,7 +1288,7 @@ def test_torch_svd( frontend_u[..., : frontend_s.shape[0]] @ np.diag(frontend_s) @ frontend_vh - ).astype(d), + ) ret_from_gt_np=u[..., : s.shape[0]] @ np.diag(s) @ vh, atol=1e-04, backend=backend_fw, From 5392ff466d25aad33dcb08d5a685d5e41ca29206 Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:41:37 +0100 Subject: [PATCH 12/14] small fixes to torch frontend blas_and_lapack_ops.py --- ivy/functional/frontends/torch/blas_and_lapack_ops.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ivy/functional/frontends/torch/blas_and_lapack_ops.py b/ivy/functional/frontends/torch/blas_and_lapack_ops.py index cd2da01ec727..d4e68a6c8e81 100644 --- a/ivy/functional/frontends/torch/blas_and_lapack_ops.py +++ b/ivy/functional/frontends/torch/blas_and_lapack_ops.py @@ -1,7 +1,8 @@ # global import ivy -from ivy.func_wrapper import with_unsupported_dtypes +from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes import ivy.functional.frontends.torch as torch_frontend +from collections import namedtuple from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back From e87356699e6383fc489ec7068a7bdd02022868ed Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:43:49 +0100 Subject: [PATCH 13/14] Update test_linalg.py --- ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py index 98386135334a..6710067a2678 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_linalg.py @@ -1288,7 +1288,7 @@ def test_torch_svd( frontend_u[..., : frontend_s.shape[0]] @ np.diag(frontend_s) @ frontend_vh - ) + ), ret_from_gt_np=u[..., : s.shape[0]] @ np.diag(s) @ vh, atol=1e-04, backend=backend_fw, @@ -1296,7 +1296,7 @@ def test_torch_svd( ) else: helpers.assert_all_close( - ret_np=(frontend_u @ np.diag(frontend_s) @ frontend_vh).astype(d), + ret_np=(frontend_u @ np.diag(frontend_s) @ frontend_vh), ret_from_gt_np=u @ np.diag(s) @ vh, atol=1e-04, backend=backend_fw, From ff195cebf10b80c60d07b1a0344f1a4363c20dde Mon Sep 17 00:00:00 2001 From: Daniel4078 <45633544+Daniel4078@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:45:08 +0100 Subject: [PATCH 14/14] Update test_tensor.py --- ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py index a43305083cb9..f7cd91bea4f8 100644 --- a/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py +++ b/ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py @@ -13148,7 +13148,7 @@ def test_torch_svd( frontend_u, frontend_s, frontend_v = frontend_ret if not compute_uv: helpers.assert_all_close( - ret_np=frontend_s + ret_np=frontend_s, ret_from_gt_np=s, atol=1e-04, backend=backend_fw,