@@ -2097,13 +2097,13 @@ def test_empty(self, shape, ord, axis, keepdims):
20972097 assert_raises (ValueError , dpnp .linalg .norm , ia , ** kwarg )
20982098 assert_raises (ValueError , numpy .linalg .norm , a , ** kwarg )
20992099 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
21022100 if ord in [- 2 , - 1 , 0 , 3 ]:
21032101 # reduction cannot be performed over zero-size axes
21042102 assert_raises (ValueError , dpnp .linalg .norm , ia , ** kwarg )
21052103 assert_raises (ValueError , numpy .linalg .norm , a , ** kwarg )
21062104 else :
2105+ # TODO: when similar changes in numpy are available, instead
2106+ # of assert_equal with zero, we should compare with numpy
21072107 # ord in [None, 1, 2]
21082108 assert_equal (dpnp .linalg .norm (ia , ** kwarg ), 0 )
21092109 else :
@@ -2295,14 +2295,15 @@ def test_matrix_norm(self, ord, keepdims):
22952295
22962296 @pytest .mark .parametrize ("dtype" , [dpnp .float32 , dpnp .int32 ])
22972297 @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 )]]
22992299 )
23002300 def test_matrix_norm_empty (self , dtype , shape_axis ):
23012301 shape , axis = shape_axis [0 ], shape_axis [1 ]
23022302 x = dpnp .zeros (shape , dtype = dtype )
23032303
23042304 # TODO: when similar changes in numpy are available,
23052305 # instead of assert_equal with zero, we should compare with numpy
2306+ assert_equal (dpnp .linalg .norm (x , axis = axis ), 0 )
23062307 assert_equal (dpnp .linalg .norm (x , axis = axis , ord = "fro" ), 0 )
23072308 assert_equal (dpnp .linalg .norm (x , axis = axis , ord = "nuc" ), 0 )
23082309 assert_equal (dpnp .linalg .norm (x , axis = axis , ord = 2 ), 0 )
@@ -2315,6 +2316,7 @@ def test_vector_norm_empty(self, dtype, axis):
23152316 x = dpnp .zeros (0 , dtype = dtype )
23162317 # TODO: when similar changes in numpy are available,
23172318 # instead of assert_equal with zero, we should compare with numpy
2319+ assert_equal (dpnp .linalg .vector_norm (x , axis = axis ), 0 )
23182320 assert_equal (dpnp .linalg .vector_norm (x , axis = axis , ord = 1 ), 0 )
23192321 assert_equal (dpnp .linalg .vector_norm (x , axis = axis , ord = 2 ), 0 )
23202322 assert_equal (dpnp .linalg .vector_norm (x , axis = axis , ord = dpnp .inf ), 0 )
0 commit comments