From 0e33faf3fe10ce88230da071dfac7bd169073178 Mon Sep 17 00:00:00 2001 From: Vahid Tavanashad Date: Fri, 24 Jan 2025 07:34:49 -0800 Subject: [PATCH] fix issue gh-2264 --- .github/workflows/array-api-skips.txt | 3 --- dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake | 2 +- dpnp/backend/cmake/Modules/oneDPLConfig.cmake | 2 +- dpnp/dpnp_utils/dpnp_utils_linearalgebra.py | 9 ++++++++- dpnp/tests/test_mathematical.py | 3 +++ 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/array-api-skips.txt b/.github/workflows/array-api-skips.txt index 6c108a165eea..2f2dab10f892 100644 --- a/.github/workflows/array-api-skips.txt +++ b/.github/workflows/array-api-skips.txt @@ -50,8 +50,5 @@ array_api_tests/test_signatures.py::test_func_signature[var] array_api_tests/test_linalg.py::test_vecdot array_api_tests/test_linalg.py::test_linalg_vecdot -# tuple index out of range -array_api_tests/test_linalg.py::test_linalg_matmul - # arrays have different values array_api_tests/test_linalg.py::test_linalg_tensordot diff --git a/dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake b/dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake index ff6d27cb8805..c67ef96a785d 100644 --- a/dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake +++ b/dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake @@ -1,5 +1,5 @@ # -# Modifications, Copyright (C) 2023-2025 Intel Corporation +# Modifications, Copyright (c) 2023-2025 Intel Corporation # # This software and the related documents are Intel copyrighted materials, and # your use of them is governed by the express license under which they were diff --git a/dpnp/backend/cmake/Modules/oneDPLConfig.cmake b/dpnp/backend/cmake/Modules/oneDPLConfig.cmake index 6473d20c69f5..bd5c12fbdabe 100644 --- a/dpnp/backend/cmake/Modules/oneDPLConfig.cmake +++ b/dpnp/backend/cmake/Modules/oneDPLConfig.cmake @@ -1,6 +1,6 @@ ##===----------------------------------------------------------------------===## # -# Copyright (C) Intel Corporation +# Copyright (c) Intel Corporation # # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # diff --git a/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py b/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py index 904ba9c4991f..7752da531a25 100644 --- a/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py +++ b/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py @@ -835,7 +835,14 @@ def dpnp_matmul( elif x1_base_is_1D and x2_base_is_1D: # TODO: implement a batch version of dot to use it here call_flag = "gemm_batch" - res_shape = result_shape + if x1_ndim == 1: + x1 = dpnp.reshape(x1, (1, 1, x1.size)) + res_shape = result_shape[:-1] + (1, result_shape[-1]) + elif x2_ndim == 1: + x2 = dpnp.reshape(x2, (1, x2.size, 1)) + res_shape = result_shape + (1,) + else: + res_shape = result_shape elif x1_is_1D and x2_is_2D: transpose = True call_flag = "gemv" diff --git a/dpnp/tests/test_mathematical.py b/dpnp/tests/test_mathematical.py index 500316ab21f3..51afa1eaf9bd 100644 --- a/dpnp/tests/test_mathematical.py +++ b/dpnp/tests/test_mathematical.py @@ -2718,6 +2718,9 @@ def setup_method(self): ((3, 3, 1), (3, 1, 2)), ((3, 3, 1), (1, 1, 2)), ((1, 3, 1), (3, 1, 2)), + ((4,), (3, 4, 1)), + ((3, 1, 4), (4,)), + ((3, 1, 4), (3, 4, 1)), ((4, 1, 3, 1), (1, 3, 1, 2)), ((1, 3, 3, 1), (4, 1, 1, 2)), ],