MCPcopy Create free account
hub / github.com/pytorch/executorch / test_ft_map_basic

Method test_ft_map_basic

test/end2end/test_end2end.py:686–723  ·  view source on GitHub ↗

Test FTMapBasic model through the modern torch.export API.

(self)

Source from the content-addressed store, hash-verified

684 )(self)
685
686 def test_ft_map_basic(self):
687 """Test FTMapBasic model through the modern torch.export API."""
688 from executorch.exir import EdgeCompileConfig, to_edge
689
690 # Create model and get inputs
691 model = FTMapBasic()
692 inputs = model.get_random_inputs()
693
694 # Export the model
695 exported_program = torch.export.export(
696 model,
697 inputs,
698 )
699
700 # Convert to edge program
701 edge_program = to_edge(
702 exported_program,
703 compile_config=EdgeCompileConfig(_check_ir_validity=False),
704 )
705
706 # Convert to executorch
707 executorch_program = edge_program.to_executorch()
708
709 # Load and run
710 executorch_module = _load_for_executorch_from_buffer(executorch_program.buffer)
711
712 # Test execution matches eager mode
713 eager_output = model(*inputs)
714 et_output = executorch_module.forward(list(inputs))[0]
715
716 # Compare outputs
717 torch.testing.assert_close(
718 et_output,
719 eager_output,
720 rtol=1e-5,
721 atol=1e-8,
722 msg="ExecuTorch output doesn't match eager output",
723 )
724
725 @skipUnless(RUN_SKIPPED, "TODO(larryliu0820) Fix this in both fbcode and oss")
726 def test_ft_cond_dynshape(self):

Callers

nothing calls this directly

Calls 7

get_random_inputsMethod · 0.95
FTMapBasicClass · 0.90
to_edgeFunction · 0.90
EdgeCompileConfigClass · 0.90
exportMethod · 0.45
to_executorchMethod · 0.45
forwardMethod · 0.45

Tested by

no test coverage detected