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

Class Method

runtime/__init__.py:130–159  ·  view source on GitHub ↗

An ExecuTorch method, loaded from a Program. This can be used to execute the method with inputs.

Source from the content-addressed store, hash-verified

128
129
130class Method:
131 """An ExecuTorch method, loaded from a Program.
132 This can be used to execute the method with inputs.
133 """
134
135 def __init__(self, method: ExecuTorchMethod) -> None:
136 self._method = method
137
138 def execute(self, inputs: Sequence[Any]) -> Sequence[Any]:
139 """Executes the method with the given inputs.
140
141 Args:
142 inputs: A sequence of input values, typically torch.Tensor objects.
143
144 Returns:
145 A list of output values, typically torch.Tensor objects.
146 """
147 return self._method(inputs)
148
149 @property
150 def metadata(self) -> MethodMeta:
151 """Gets the metadata for the method.
152
153 The metadata includes information about input and output specifications,
154 such as tensor shapes, data types, and memory requirements.
155
156 Returns:
157 The MethodMeta object containing method specifications.
158 """
159 return self._method.method_meta()
160
161
162class Program:

Callers 1

load_methodMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected