@@ -2750,34 +2750,44 @@ def test_forward_one_hot():
27502750# ----
27512751
27522752
2753- def _test_pack (data , axis ):
2753+ def _test_pack (data , is_var , axis ):
27542754 """ One iteration of pack """
27552755
27562756 assert len (data ) >= 1
2757+ assert len (data ) == len (is_var )
27572758
27582759 with tf .Graph ().as_default ():
27592760 in_data = [
2760- array_ops .placeholder (shape = tensor .shape , dtype = tensor .dtype , name = "in_{}" .format (idx ))
2761- for idx , tensor in enumerate (data )
2761+ array_ops .placeholder (shape = d .shape , dtype = d .dtype , name = "in_" + str (idx ))
2762+ if is_var [idx ]
2763+ else constant_op .constant (
2764+ d , shape = d .shape , dtype = d .dtype , name = "in_constant_" + str (idx )
2765+ )
2766+ for idx , d in enumerate (data )
27622767 ]
2763- out = array_ops .pack (in_data , axis = axis )
2764- name = ["in_{}:0" .format (idx ) for idx in range (len (data ))]
27652768
2766- compare_tflite_with_tvm (data , name , in_data , [out ])
2769+ out = array_ops .pack (in_data , axis = axis )
2770+ name = [_ .name for _ in in_data ]
2771+ compare_tflite_with_tvm (data , name , in_data , [out ], experimental_new_converter = True )
27672772
27682773
27692774def test_forward_pack ():
27702775 """ Pack """
2771- _test_pack ([np .arange (6 ).reshape ((1 , 2 , 1 , 3 )), np .arange (6 ).reshape ((1 , 2 , 1 , 3 ))], 1 )
2776+ _test_pack ([np .int32 (1 ), np .int32 (5 )], [False , False ], 0 )
2777+ _test_pack ([np .array ([1 , 4 ]), np .array ([2 , 5 ]), np .array ([3 , 6 ])], [True , False , False ], 0 )
2778+ _test_pack (
2779+ [np .arange (6 ).reshape ((1 , 2 , 1 , 3 )), np .arange (6 ).reshape ((1 , 2 , 1 , 3 ))], [True , True ], 1
2780+ )
27722781
2773- _test_pack ([np .arange (6 ).reshape ((3 , 2 )), np .arange (6 ).reshape ((3 , 2 ))], 1 )
2782+ _test_pack ([np .arange (6 ).reshape ((3 , 2 )), np .arange (6 ).reshape ((3 , 2 ))], [ True , True ], 1 )
27742783
27752784 _test_pack (
27762785 [
27772786 np .arange (6 ).reshape ((2 , 1 , 1 , 3 )),
27782787 np .arange (6 ).reshape ((2 , 1 , 1 , 3 )),
27792788 np .arange (6 ).reshape ((2 , 1 , 1 , 3 )),
27802789 ],
2790+ [True , True , True ],
27812791 1 ,
27822792 )
27832793
0 commit comments