Lunderberg opened a new pull request, #16686:
URL: https://github.com/apache/tvm/pull/16686
Prior to this commit, if an optimized `nn.Module` implementation were
defined, either the model definition needed to be rewritten to include the
optimized implementation, or the user needed to write their own `nn.Mutator`
implementation.
This commit implements `nn.replace_implementation`, which provides a
`nn.Mutator` that replaces all instances of a `nn.Module` with an optimized
implementation. This allows a user to write optimized implementations as
subclasses, such as shown below.
```python
class BaseImplementation(nn.Module):
...
class OptimizedImplementation(BaseImplementation):
...
```
After defining the optimized implementation,
`nn.replace_implementation(OptimizedImplementation)` returns a `nn.Mutator`
that can inject the optimized module into an existing end-to-end SLM model. In
addition, the SLM-to-SLM transformation can be converted into a Relax-to-Relax
transformation, allowing an easy path for migrating optimized kernels into a
Relax optimation pipeline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]