@@ -2097,13 +2097,13 @@ def test_empty(self, shape, ord, axis, keepdims):
2097
2097
assert_raises (ValueError , dpnp .linalg .norm , ia , ** kwarg )
2098
2098
assert_raises (ValueError , numpy .linalg .norm , a , ** kwarg )
2099
2099
elif axis is None and a .ndim != 1 and a .shape [- 1 ] == 0 :
2100
- # TODO: when similar changes in numpy are available,
2101
- # instead of assert_equal with zero, we should compare with numpy
2102
2100
if ord in [- 2 , - 1 , 0 , 3 ]:
2103
2101
# reduction cannot be performed over zero-size axes
2104
2102
assert_raises (ValueError , dpnp .linalg .norm , ia , ** kwarg )
2105
2103
assert_raises (ValueError , numpy .linalg .norm , a , ** kwarg )
2106
2104
else :
2105
+ # TODO: when similar changes in numpy are available, instead
2106
+ # of assert_equal with zero, we should compare with numpy
2107
2107
# ord in [None, 1, 2]
2108
2108
assert_equal (dpnp .linalg .norm (ia , ** kwarg ), 0 )
2109
2109
else :
@@ -2295,14 +2295,15 @@ def test_matrix_norm(self, ord, keepdims):
2295
2295
2296
2296
@pytest .mark .parametrize ("dtype" , [dpnp .float32 , dpnp .int32 ])
2297
2297
@pytest .mark .parametrize (
2298
- "shape_axis" , [[(2 , 0 ), None ], [(2 , 0 , 3 ), (0 , 1 )]]
2298
+ "shape_axis" , [[(2 , 0 ), None ], [(2 , 0 ), ( 0 , 1 )], [( 0 , 2 ), (0 , 1 )]]
2299
2299
)
2300
2300
def test_matrix_norm_empty (self , dtype , shape_axis ):
2301
2301
shape , axis = shape_axis [0 ], shape_axis [1 ]
2302
2302
x = dpnp .zeros (shape , dtype = dtype )
2303
2303
2304
2304
# TODO: when similar changes in numpy are available,
2305
2305
# instead of assert_equal with zero, we should compare with numpy
2306
+ assert_equal (dpnp .linalg .norm (x , axis = axis ), 0 )
2306
2307
assert_equal (dpnp .linalg .norm (x , axis = axis , ord = "fro" ), 0 )
2307
2308
assert_equal (dpnp .linalg .norm (x , axis = axis , ord = "nuc" ), 0 )
2308
2309
assert_equal (dpnp .linalg .norm (x , axis = axis , ord = 2 ), 0 )
@@ -2315,6 +2316,7 @@ def test_vector_norm_empty(self, dtype, axis):
2315
2316
x = dpnp .zeros (0 , dtype = dtype )
2316
2317
# TODO: when similar changes in numpy are available,
2317
2318
# instead of assert_equal with zero, we should compare with numpy
2319
+ assert_equal (dpnp .linalg .vector_norm (x , axis = axis ), 0 )
2318
2320
assert_equal (dpnp .linalg .vector_norm (x , axis = axis , ord = 1 ), 0 )
2319
2321
assert_equal (dpnp .linalg .vector_norm (x , axis = axis , ord = 2 ), 0 )
2320
2322
assert_equal (dpnp .linalg .vector_norm (x , axis = axis , ord = dpnp .inf ), 0 )
0 commit comments