@@ -232,6 +232,13 @@ def test_dygraph(self):
232232 x = paddle .to_tensor (input_x )
233233 result = paddle .unique_consecutive (x )
234234
235+ def test_dygraph_alias (self ):
236+ for place in self .places :
237+ with base .dygraph .guard (place ):
238+ input_x = np .random .randint (20 , size = 100 ).astype ("float64" )
239+ x = paddle .to_tensor (input_x )
240+ result = paddle .unique_consecutive (input = x )
241+
235242
236243class TestUniqueConsecutiveCase2API (unittest .TestCase ):
237244 def setUp (self ):
@@ -299,9 +306,32 @@ def check_static_result(self, place):
299306 fetch_list = [result ],
300307 )
301308
309+ def check_static_result_alias (self , place ):
310+ with paddle .static .program_guard (
311+ paddle .static .Program (), paddle .static .Program ()
312+ ):
313+ paddle .enable_static ()
314+ input_x = paddle .static .data (
315+ name = "input_x" ,
316+ shape = [
317+ 100 ,
318+ ],
319+ dtype = "float32" ,
320+ )
321+ result , inverse , counts = paddle .unique_consecutive (
322+ input = input_x , return_inverse = True , return_counts = True , axis = - 1
323+ )
324+ x_np = np .random .randint (20 , size = 100 ).astype ("float32" )
325+ exe = base .Executor (place )
326+ fetches = exe .run (
327+ feed = {"input_x" : x_np },
328+ fetch_list = [result ],
329+ )
330+
302331 def test_static (self ):
303332 for place in self .places :
304333 self .check_static_result (place = place )
334+ self .check_static_result_alias (place = place )
305335
306336 def test_dygraph (self ):
307337 for place in self .places :
0 commit comments