#NEWLINE# def test_shape_operations( self ) : #NEWLINE# #INDENT# xval = np . random . random ( ( 4 , 3 ) ) #NEWLINE# xth = KTH . variable ( xval ) #NEWLINE# xtf = KTF . variable ( xval ) #NEWLINE# yval = np . random . random ( ( 4 , 2 ) ) #NEWLINE# yth = KTH . variable ( yval ) #NEWLINE# ytf = KTF . variable ( yval ) #NEWLINE# zth = KTH . eval ( KTH . concatenate ( [ xth , yth ] , axis = ( - 1 ) ) ) #NEWLINE# ztf = KTF . eval ( KTF . concatenate ( [ xtf , ytf ] , axis = ( - 1 ) ) ) #NEWLINE# assert ( zth . shape == ztf . shape ) #NEWLINE# assert_allclose ( zth , ztf , atol = 1e-05 ) #NEWLINE# check_single_tensor_operation ( 'reshape' , ( 4 , 2 ) , shape = ( 8 , 1 ) ) #NEWLINE# check_single_tensor_operation ( 'permute_dimensions' , ( 4 , 2 , 3 ) , pattern = ( 2 , 0 , 1 ) ) #NEWLINE# check_single_tensor_operation ( 'repeat' , ( 4 , 1 ) , n = 3 ) #NEWLINE# check_single_tensor_operation ( 'flatten' , ( 4 , 1 ) ) #NEWLINE# check_single_tensor_operation ( 'expand_dims' , ( 4 , 3 ) , dim = ( - 1 ) ) #NEWLINE# check_single_tensor_operation ( 'expand_dims' , ( 4 , 3 , 2 ) , dim = 1 ) #NEWLINE# check_single_tensor_operation ( 'squeeze' , ( 4 , 3 , 1 ) , axis = 2 )