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

Function get_exported_programs

exir/program/test/test_program.py:150–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148
149
150def get_exported_programs() -> Dict[str, ExportedProgram]:
151 class Forward(torch.nn.Module):
152 def forward(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
153 z = torch.mul(x, y)
154 return torch.add(z, x)
155
156 forward = Forward()
157
158 class Foo(torch.nn.Module):
159 def forward(self, x: torch.Tensor) -> torch.Tensor:
160 return torch.add(x, torch.ones(1))
161
162 foo = Foo()
163
164 programs = {}
165 programs["forward"] = export(
166 forward,
167 args=(
168 torch.ones(1),
169 torch.zeros(1),
170 ),
171 strict=True,
172 ).run_decompositions()
173 programs["foo"] = export(foo, (torch.ones(1),), strict=True).run_decompositions()
174 return programs
175
176
177def get_config_methods() -> Dict[str, Any]:

Calls 5

exportFunction · 0.90
ForwardClass · 0.85
onesMethod · 0.80
zerosMethod · 0.80
FooClass · 0.70

Tested by

no test coverage detected