add support for 0 sized array in svd
@@ -357,7 +357,16 @@ def svd(a, full_matrices=True, compute_uv=True):
m, n = a.shape
x = a.transpose().astype(a_dtype, order='C', copy=True)
trans_flag = True
+
mn = min(m, n)
+ if mn == 0:
+ if compute_uv:
+ if full_matrices:
+ return cupy.eye(m, m), cupy.array([]), cupy.empty((0, 0))
+ else:
+ return cupy.empty(m, 0), cupy.array([]), cupy.empty((0, 0))
+ else:
+ return cupy.array([])
if compute_uv:
if full_matrices:
