Comments (4)
Hi @ganler , thank you so much for your detailed answer. The explanations and examples are very clear to me, so I close this issue.
BTW, most of NNSmith's code is well-designed and self-explanatory, nice job!
from nnsmith.
Hi Chijin, your understanding is basically correct! There are a few more details / resources that can be helpful:
Adding an operator requires a specification. You can learn about the concept of an operator specification/rule via:
- Section 2 of NeuRI paper (https://arxiv.org/pdf/2302.02261.pdf)
- Section 3.1 of NNSmith (https://arxiv.org/pdf/2207.13066.pdf)
Regarding implementation of op spec, you can find the quick tutorial in https://github.com/ise-uiuc/nnsmith/blob/main/doc/concept.md and various examples in:
- nnsmith/abstract/op.py: if the op is very general;
- nnsmith/materialize/torch/dialect.py: if the op is specific to PyTorch operators;
- nnsmith/materialize/tensorflow/dialect.py: if the op is specific to TF operators;
Once you are done with defining an operator specification. You can materialize the operator in https://github.com/ise-uiuc/nnsmith/blob/main/nnsmith/materialize/torch/forward.py (for PyTorch) or https://github.com/ise-uiuc/nnsmith/blob/main/nnsmith/materialize/tensorflow/forward.py (for TF).
from nnsmith.
As a reference, you may find this PR a helpful example: https://github.com/ise-uiuc/nnsmith/pull/98/files
from nnsmith.
In your case of Split
, please note that the modeling of operators in NNSmith requires the number of inputs/outputs to be fixed. A typical split operator could variadic outputs (https://pytorch.org/docs/stable/generated/torch.split.html). Nonetheless, you can still implement multiple versions of Split
, say Split1
(only one output), Split2
(2 outputs, etc)... You follow how Concat is implemented for reference: https://github.com/ise-uiuc/nnsmith/blob/main/nnsmith/abstract/op.py#L1904
Let me know if you have more questions. Sorry for the incomplete documents -- will enhance it as long as I have time at hand. For now please feel free to submit an issue and ping me for any undocument questions! Thanks!
from nnsmith.
Related Issues (20)
- [Tracking] Make Python >= 3.8 mandatory
- 💡 [Dynamic Graph] - Does nnsmith support dynamic graphs? HOT 3
- 💡 [REQUEST] TF Coverage Tutorial and Script
- TF Coverage Scripts and Tutorial HOT 1
- [Dev] `hydra` -> `click`
- [Question] Customize the number of input/output variables in generated graphs HOT 9
- 🐛 [BUG] - <`ONNXModelCPU_tvm_0.9.0_cpu.yaml` file was empty, can't get opset properly properly> HOT 11
- Render seems to not work HOT 6
- 🐛 [BUG] - There is a problem with relative import in `fuzz.py` HOT 2
- Some questions about the replication of the experiment HOT 6
- Problems encountered while compiling the onnx model HOT 4
- [Help wanted] How to get the shape of the output tensor of a operator HOT 5
- [Help wanted] How to get the result of executing model_exec.py? HOT 7
- [User Question] integer type annotation in TVM HOT 2
- 🐛 [BUG] - <An error occurred when loading the onnx model generated by nnsmith using tvm.delay.> HOT 1
- [Help Wanted] Problems encountered when converting the onnx model to tvm.relay HOT 3
- [Help Wanted] How to only generate sequential models HOT 2
- Help Wanted - How does one generate minimum code examples from NNSmith bug reports HOT 3
- Instruction of TVM COV HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nnsmith.