20
20
# @manual=//executorch/extension/pytree:pybindings
21
21
import executorch .extension .pytree as pytree
22
22
import torch
23
- from executorch .bundled_program .config import BundledConfig
24
23
25
- from executorch .bundled_program .core import create_bundled_program
26
- from executorch .bundled_program .serialize import (
27
- serialize_from_bundled_program_to_flatbuffer ,
28
- )
29
24
from executorch .exir import (
30
25
CaptureConfig ,
31
26
EdgeCompileConfig ,
@@ -486,7 +481,6 @@ def maketest(
486
481
allow_non_contiguous_tensor : bool = False ,
487
482
method : str = "forward" ,
488
483
dynamic_memory_planning_mode : DynamicMemoryPlanningMode = DynamicMemoryPlanningMode .UPPER_BOUND ,
489
- bundled_io = False ,
490
484
capture_config = None ,
491
485
verify_graph : Optional [Callable ] = None ,
492
486
) -> Callable [[unittest .TestCase ], None ]:
@@ -510,9 +504,6 @@ def maketest(
510
504
program only contains contiguous tensors.
511
505
method: The name of the module_cls method to trace.
512
506
dynamic_memory_planning_mode: The dynamic memory planning mode to use.
513
- bundled_io: If true, will wrap the given program into bundled program
514
- format, run and compared the program with bundled input and expected
515
- output.
516
507
517
508
Returns:
518
509
A TestCase method that tests the provided module class and method.
@@ -587,54 +578,6 @@ def wrapper(self: unittest.TestCase) -> None:
587
578
print (f"actual result: { actual } " )
588
579
self .assertTrue (is_close )
589
580
590
- if bundled_io :
591
- print ("Being verified by Bundled Program" )
592
- expected_outputs_list = [
593
- [[module .eager_module (* x )] for x in inputs_list ],
594
- ]
595
- bundled_config = BundledConfig (
596
- [
597
- method ,
598
- ],
599
- [
600
- inputs_list ,
601
- ],
602
- expected_outputs_list ,
603
- )
604
- bundled_program = create_bundled_program (
605
- module .executorch_program .program , bundled_config
606
- )
607
- bundled_program_buffer = serialize_from_bundled_program_to_flatbuffer (
608
- bundled_program
609
- )
610
-
611
- # pyre-fixme[16]: Module `executorch.extension.pybindings` has no attribute `portable`.
612
- executorch_bundled_program = _load_bundled_program_from_buffer (
613
- bundled_program_buffer
614
- )
615
-
616
- # pyre-fixme[16]: Module `executorch.extension.pybindings` has no attribute `portable`.
617
- executorch_module = _load_for_executorch_from_bundled_program (
618
- executorch_bundled_program
619
- )
620
-
621
- default_execution_plan_id = 0
622
-
623
- # TODO(T144329357): check bundled attachment correctness
624
- # No load_bundled_input() method
625
- # for testset_idx in range(niter):
626
- # executorch_module.load_bundled_input(
627
- # executorch_bundled_program,
628
- # default_execution_plan_id,
629
- # testset_idx,
630
- # )
631
- # executorch_module.plan_execute()
632
- # executorch_module.verify_result_with_bundled_expected_output(
633
- # executorch_bundled_program,
634
- # default_execution_plan_id,
635
- # testset_idx,
636
- # )
637
-
638
581
return wrapper
639
582
640
583
@@ -823,55 +766,3 @@ def test_batch_norm(self):
823
766
# run this on aten mode.
824
767
run_executor = is_aten_mode ,
825
768
)(self )
826
-
827
-
828
- class BundledProgramE2ETest (unittest .TestCase ):
829
- # Using all models supporting executor running in this test.
830
-
831
- def test_mem_planning_toy_model_bundled_program (self ):
832
- maketest (ToyModelForMemPlanning , bundled_io = True )(self )
833
-
834
- def test_executorch_forward_bundled_program (self ):
835
- maketest (ModuleAdd , bundled_io = True )(self )
836
-
837
- @skipUnless (RUN_SKIPPED , "TODO(larryliu0820) Fix this in both fbcode and oss" )
838
- def test_containers_bundled_program (self ):
839
- maketest (ModuleContainers , do_tree_flatten = True , bundled_io = True )(self )
840
-
841
- # Failed to produce a graph during tracing w/ dynamo because there are no torch ops
842
- # test_return_input_bundled_program = maketest(
843
- # ModuleReturnInput, do_tree_flatten=True, bundled_io=True
844
- # )
845
-
846
- # can not run this on the executor because missing the following ops:
847
- # aten::select_copy.int_out, aten::eq.Scalar_out
848
- # TODO(gasoonjia) re-enable these tests.
849
- # test_ifelse_bundled_program = maketest(ModuleIfElse, bundled_io=True)
850
- # test_ifelse_with_bool_bundled_program = maketest(ModuleIfElseWithBool, bundled_io=True)
851
-
852
- # fail to trace with functionalization enabled
853
- # Fail with error: Missing out variants: {'aten::select', 'aten::_shape_as_tensor', 'aten::tensor_split'}
854
- # TODO(gasoonjia) re-enable these tests.
855
- # test_while_bundled_program = maketest(ModuleWhile, bundled_io=True)
856
-
857
- # test_while_if_bundled_program = maketest(ModuleWhileIf, bundled_io=True)
858
- # test_if_while_bundled_program = maketest(ModuleIfWhile, bundled_io=True)
859
-
860
- def test_input_dynamic_shape_bundled_program (self ):
861
- maketest (
862
- ModuleInputDynamicShape ,
863
- run_graph_module = False ,
864
- bundled_io = True ,
865
- capture_config = exir .CaptureConfig (
866
- enable_dynamic_shape = True ,
867
- ),
868
- )(self )
869
-
870
- @skip ("revisit when unbacked symint is ready" )
871
- def test_intermediate_dynamic_shape_bundled_program (self ):
872
- maketest (
873
- ModuleIntermediateDynamicShape ,
874
- run_graph_module = False ,
875
- allow_non_contiguous_tensor = True ,
876
- bundled_io = True ,
877
- )(self )
0 commit comments