An ExecuTorch method, loaded from a Program. This can be used to execute the method with inputs.
| 128 | |
| 129 | |
| 130 | class 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 | |
| 162 | class Program: |