Skip to content

Commit 1fac6e6

Browse files
committed
modifying dpnp.linalg.qr function
1 parent 4850e53 commit 1fac6e6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

dpnp/backend/kernels/dpnp_krnl_linalg.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,9 @@ DPCTLSyclEventRef dpnp_qr_c(DPCTLSyclQueueRef q_ref,
612612
(void)dep_event_vec_ref;
613613

614614
DPCTLSyclEventRef event_ref = nullptr;
615+
if (!size_m || !size_n) {
616+
return event_ref;
617+
}
615618
sycl::queue q = *(reinterpret_cast<sycl::queue *>(q_ref));
616619

617620
sycl::event event;

dpnp/linalg/dpnp_iface_linalg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ def qr(x1, mode="reduced"):
488488

489489
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
490490
if x1_desc:
491-
if mode != "reduced":
491+
if x1_desc.ndim != 2:
492+
pass
493+
elif mode != "reduced":
492494
pass
493495
else:
494496
result_tup = dpnp_qr(x1_desc, mode)

tests/test_linalg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ def test_norm3(array, ord, axis):
358358
@pytest.mark.parametrize("type", get_all_dtypes(no_bool=True, no_complex=True))
359359
@pytest.mark.parametrize(
360360
"shape",
361-
[(2, 2), (3, 4), (5, 3), (16, 16)],
362-
ids=["(2,2)", "(3,4)", "(5,3)", "(16,16)"],
361+
[(2, 2), (3, 4), (5, 3), (16, 16), (0, 0), (0, 2), (2, 0)],
362+
ids=["(2,2)", "(3,4)", "(5,3)", "(16,16)", "(0,0)", "(0,2)", "(2,0)"],
363363
)
364364
@pytest.mark.parametrize(
365365
"mode", ["complete", "reduced"], ids=["complete", "reduced"]

0 commit comments

Comments
 (0)