@@ -804,7 +804,7 @@ def setUp(self):
804804 def test_static_check (self ):
805805 with static_guard ():
806806 for x_np , out_ref in zip (self .x_np_list , self .out_ref_list ):
807- func = compat .softmax
807+ func = compat .nn . functional . softmax
808808 with paddle .static .program_guard (paddle .static .Program ()):
809809 x = paddle .static .data ('X' , x_np .shape , 'float32' )
810810 out1 = func (input = x , dim = None , _stacklevel = 3 )
@@ -854,7 +854,7 @@ def test_static_check(self):
854854 def test_dygraph_check (self ):
855855 paddle .disable_static (self .place )
856856 for x_np , out_ref in zip (self .x_np_list , self .out_ref_list ):
857- func = compat .softmax
857+ func = compat .nn . functional . softmax
858858 x = paddle .to_tensor (x_np )
859859 out1 = func (input = x , dim = None , _stacklevel = 3 )
860860 x = paddle .to_tensor (x_np )
@@ -964,12 +964,18 @@ def test_forbid_keywords(self):
964964 paddle .static .program_guard (paddle .static .Program ()),
965965 ):
966966 x = paddle .static .data ('X' , [2 , 3 ], 'float32' )
967- self .assertRaises (TypeError , compat .softmax , x = x , axis = - 1 )
968- self .assertRaises (TypeError , compat .softmax , x = x , dim = - 1 )
969- self .assertRaises (TypeError , compat .softmax , input = x , axis = - 1 )
967+ self .assertRaises (
968+ TypeError , compat .nn .functional .softmax , x = x , axis = - 1
969+ )
970+ self .assertRaises (
971+ TypeError , compat .nn .functional .softmax , x = x , dim = - 1
972+ )
973+ self .assertRaises (
974+ TypeError , compat .nn .functional .softmax , input = x , axis = - 1
975+ )
970976
971977 if core .is_compiled_with_cuda () or is_custom_device ():
972- compat .softmax (input = x , dim = - 1 )
978+ compat .nn . functional . softmax (input = x , dim = - 1 )
973979
974980
975981if __name__ == "__main__" :
0 commit comments