SlideShare a Scribd company logo
1 of 19
ONNX to DNNC Symbol Table:
Status Update
Colin Lu, AI Engineering Intern
Ravit Sharma, Software Engineering Intern
https://github.com/ai-techsystems/dnnCompiler
A Step Back: DNN Compiler
Overview
Project Goal
Use Symbol Table as Input
to LLVM
Obtain ONNX Model
Parse ONNX Model into
Symbol Table
What is ONNX?
- An open format that can represent models from different
frameworks
- Currently only ONNX operators (neural networks/DL) are supported
by DNNC, not ONNX-ML (classical ML)
- Contains the computation graph for a particular DL Model
ONNX vs ONNX-ML
ONNX operator set (neural networks)
- Convolutional layers, activation functions, etc.
- Utility and math functions
e.g. flatten tensor and log, respectively
ONNX-ML (classical ML)
- Classical models, like SVM and tree ensemble
(possibly for random forest, boosted trees, etc.)
- Data processing utilities
e.g. imputing missing values, one-hot encoding
The complete listing for ONNX and ONNX-ML operator sets can be found here:
- ONNX: https://github.com/onnx/onnx/blob/master/docs/Operators.md
- ONNX-ML: https://github.com/onnx/onnx/blob/master/docs/Operators-
Symbol Table Formatting
- Represented as text file containing model structure
- Should have standardized format, regardless of whether ONNX or
some other format (e.g. Caffe) is being used to generate the table.
Symbol Table Formatting
ONNX Format
Symbol Table
Format
Protobuf Encoding of .onnx
- Model information is stored in an .onnx file as a binary following
onnx.proto3 format
- Needs a .proto file in order to decode the binary. A .proto has
definitions for classes (e.g. models, graphs, nodes, etc.)
- Must be compiled in terminal using the protoc command, generating a source
file that can be imported
Protobuf Encoding of .onnx
- After .onnx binary is loaded in to an appropriate object in your
source file (onnx.ModelProto object in the python script)
- Relevant attributes are filled in and the object ready for use
Loading the ONNX Model
Step-by-step of ONNX model
loading
● Gather the .onnx (model stored as binary) and .proto (class definition
used to decode the .onnx)
● Compile the .proto into a (.py or other language) source file
○ Command: protoc -I=$SRC_DIR --python_out=$DST_DIR
$SRC_DIR/[filename].[proto/proto3]
○ For example: protoc -I=. --python_out=. ./onnx.proto3
● (Working in .py file now, not terminal) Import source file created by
protoc
○ Source file should be in ./onnx/proto3_pb2.py; add an empty __init__.py inside ./onnx to
allow python to recognize proto3_pb2.py as an importable library
○ In python: from onnx import proto3_pb2
Step-by-step of ONNX model
loading
● Create template variable to be filled in with data from the .onnx binary
○ In python: model = proto3_pb2.ModelProto()
● Load in the data from the binary
○ In python: with open(“model.onnx”, “rb”) as f:
model.ParseFromString(f.read())
At this point model can be accessed like a regular object, e.g. use model.graph.node to
get a list of nodes.
ONNX model structure
A .onnx file is organized in the following hierarchy:
All possible attributes of the model, graph, node objects, etc. are
described in the onnx.proto3 file.
ONNX Graph Paradigm
- Similarly to TensorFlow and some other frameworks, ONNX
represents a model as a computational graph (example image on
next page)
- Operations like addition, activation functions (e.g. ReLU),
convolutional layers, etc. are represented as nodes in the
computational graph
Sample Computation Graph
- Graph on right displays flow of
operations from input to output
- This information is represented in
.onnx file
Functions of ONNX Classes
● Model
○ Overarching class; the entire .onnx file describes a single model
○ Basically a wrapper for a graph object + metadata (such as version of
the ONNX representation, and the operator set version)
● Graph
○ Collection of elements that make up the computational graph
○ The graph object is what you might think of as the ML model, i.e. a
neural network that takes in inputs and computes outputs
Functions of ONNX Classes
● Node
○ Each node in the graph represents an operation, such as max pooling,
reshaping a tensor, adding a bias, etc.
○ In ONNX, is represented by the op_type, inputs, and outputs, along with any
attributes necessary to perform the operation (e.g. stride for a maxpool op)
● Input/Output
○ Primarily composed of some metadata (tensor name, docstrings) + Tensor
object, which contains the type (int32, float, etc.) and tensor dimensions
Pseudocode of Parser
Testing
● A set of test cases with expected outputs will be created to verify that there are no bugs or
missing components in current or future versions of the symbol table generator.
● Around 50 test cases is the target, including some common CNN architectures (ResNet,
GoogLeNet, etc.)
Next Steps Proposal
● Testing
○ Writing test cases to verify parser is working
○ Integration into github (CI)
● Next components in the compiler pipeline
○ Research on LLVM and processing the symbol table

More Related Content

What's hot

Dynamic Memory Allocation
Dynamic Memory AllocationDynamic Memory Allocation
Dynamic Memory Allocationvaani pathak
 
xlwings - Connecting Python with Excel
xlwings - Connecting Python with Excelxlwings - Connecting Python with Excel
xlwings - Connecting Python with Excelxlwings
 
The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202Mahmoud Samir Fayed
 
Standard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented ProgrammingStandard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented ProgrammingMandeep Singh
 
PyData NYC whatsnew NumPy-SciPy 2019
PyData NYC whatsnew NumPy-SciPy 2019PyData NYC whatsnew NumPy-SciPy 2019
PyData NYC whatsnew NumPy-SciPy 2019Ralf Gommers
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersJen Yee Hong
 
Ruby basics ||
Ruby basics ||Ruby basics ||
Ruby basics ||datt30
 
Security coding c and c++ ch8(2)
Security coding c and c++   ch8(2)Security coding c and c++   ch8(2)
Security coding c and c++ ch8(2)Chia-Hao Tsai
 
Python advanced 3.the python std lib by example –data structures
Python advanced 3.the python std lib by example –data structuresPython advanced 3.the python std lib by example –data structures
Python advanced 3.the python std lib by example –data structuresJohn(Qiang) Zhang
 
xlwings Zurich Python User Group Meetup
xlwings Zurich Python User Group Meetupxlwings Zurich Python User Group Meetup
xlwings Zurich Python User Group Meetupxlwings
 
Industry - Program analysis and verification - Type-preserving Heap Profiler ...
Industry - Program analysis and verification - Type-preserving Heap Profiler ...Industry - Program analysis and verification - Type-preserving Heap Profiler ...
Industry - Program analysis and verification - Type-preserving Heap Profiler ...ICSM 2011
 
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)Sylvain Hallé
 
Python advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithmPython advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithmJohn(Qiang) Zhang
 

What's hot (20)

Linked lists
Linked listsLinked lists
Linked lists
 
Dynamic Memory Allocation
Dynamic Memory AllocationDynamic Memory Allocation
Dynamic Memory Allocation
 
xlwings - Connecting Python with Excel
xlwings - Connecting Python with Excelxlwings - Connecting Python with Excel
xlwings - Connecting Python with Excel
 
Stack Data structure
Stack Data structureStack Data structure
Stack Data structure
 
The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202The Ring programming language version 1.8 book - Part 86 of 202
The Ring programming language version 1.8 book - Part 86 of 202
 
Standard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented ProgrammingStandard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented Programming
 
PyData NYC whatsnew NumPy-SciPy 2019
PyData NYC whatsnew NumPy-SciPy 2019PyData NYC whatsnew NumPy-SciPy 2019
PyData NYC whatsnew NumPy-SciPy 2019
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmers
 
Ruby basics ||
Ruby basics ||Ruby basics ||
Ruby basics ||
 
The Stack and Buffer Overflows
The Stack and Buffer OverflowsThe Stack and Buffer Overflows
The Stack and Buffer Overflows
 
Security coding c and c++ ch8(2)
Security coding c and c++   ch8(2)Security coding c and c++   ch8(2)
Security coding c and c++ ch8(2)
 
Data structure
Data structureData structure
Data structure
 
Python advanced 3.the python std lib by example –data structures
Python advanced 3.the python std lib by example –data structuresPython advanced 3.the python std lib by example –data structures
Python advanced 3.the python std lib by example –data structures
 
Actividad N° 6 - Unidad 4
Actividad N° 6 - Unidad 4Actividad N° 6 - Unidad 4
Actividad N° 6 - Unidad 4
 
xlwings Zurich Python User Group Meetup
xlwings Zurich Python User Group Meetupxlwings Zurich Python User Group Meetup
xlwings Zurich Python User Group Meetup
 
Industry - Program analysis and verification - Type-preserving Heap Profiler ...
Industry - Program analysis and verification - Type-preserving Heap Profiler ...Industry - Program analysis and verification - Type-preserving Heap Profiler ...
Industry - Program analysis and verification - Type-preserving Heap Profiler ...
 
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Streams&io
Streams&ioStreams&io
Streams&io
 
Python advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithmPython advanced 3.the python std lib by example – algorithm
Python advanced 3.the python std lib by example – algorithm
 

Similar to ONNX to DNNC Symbol Table Parser Updates

Onnx and onnx runtime
Onnx and onnx runtimeOnnx and onnx runtime
Onnx and onnx runtimeVishwas N
 
Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonRalf Gommers
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfrajeshjangid1865
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxfaithxdunce63732
 
WiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitr
WiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitrWiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitr
WiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitrAnn Loraine
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Itzik Kotler
 
James Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonJames Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonCP-Union
 
Advanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.pptAdvanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.pptAnshika865276
 
U Xml Defense presentation
U Xml Defense presentationU Xml Defense presentation
U Xml Defense presentationksp4186
 
Raspberry pi Part 6
Raspberry pi Part 6Raspberry pi Part 6
Raspberry pi Part 6Techvilla
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on pythonShubham Yadav
 
pythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxpythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxRameshMishra84
 
How to obtain and install R.ppt
How to obtain and install R.pptHow to obtain and install R.ppt
How to obtain and install R.pptrajalakshmi5921
 
24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmm
24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmm24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmm
24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmmSasidharaKashyapChat
 
TensorFlow and Keras: An Overview
TensorFlow and Keras: An OverviewTensorFlow and Keras: An Overview
TensorFlow and Keras: An OverviewPoo Kuan Hoong
 

Similar to ONNX to DNNC Symbol Table Parser Updates (20)

Onnx and onnx runtime
Onnx and onnx runtimeOnnx and onnx runtime
Onnx and onnx runtime
 
Onyx
OnyxOnyx
Onyx
 
Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for Python
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdf
 
Scala qq
Scala qqScala qq
Scala qq
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
 
WiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitr
WiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitrWiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitr
WiNGS 2014 Workshop 2 R, RStudio, and reproducible research with knitr
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
 
James Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonJames Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on Python
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
 
Advanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.pptAdvanced Data Analytics with R Programming.ppt
Advanced Data Analytics with R Programming.ppt
 
U Xml Defense presentation
U Xml Defense presentationU Xml Defense presentation
U Xml Defense presentation
 
Meetup tensorframes
Meetup tensorframesMeetup tensorframes
Meetup tensorframes
 
Raspberry pi Part 6
Raspberry pi Part 6Raspberry pi Part 6
Raspberry pi Part 6
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
 
Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
 
pythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxpythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docx
 
How to obtain and install R.ppt
How to obtain and install R.pptHow to obtain and install R.ppt
How to obtain and install R.ppt
 
24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmm
24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmm24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmm
24-TensorFlow-Clipper.pptxnjjjjnjjjjjjmm
 
TensorFlow and Keras: An Overview
TensorFlow and Keras: An OverviewTensorFlow and Keras: An Overview
TensorFlow and Keras: An Overview
 

Recently uploaded

FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 

Recently uploaded (20)

FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 

ONNX to DNNC Symbol Table Parser Updates

  • 1. ONNX to DNNC Symbol Table: Status Update Colin Lu, AI Engineering Intern Ravit Sharma, Software Engineering Intern https://github.com/ai-techsystems/dnnCompiler
  • 2. A Step Back: DNN Compiler Overview
  • 3. Project Goal Use Symbol Table as Input to LLVM Obtain ONNX Model Parse ONNX Model into Symbol Table
  • 4. What is ONNX? - An open format that can represent models from different frameworks - Currently only ONNX operators (neural networks/DL) are supported by DNNC, not ONNX-ML (classical ML) - Contains the computation graph for a particular DL Model
  • 5. ONNX vs ONNX-ML ONNX operator set (neural networks) - Convolutional layers, activation functions, etc. - Utility and math functions e.g. flatten tensor and log, respectively ONNX-ML (classical ML) - Classical models, like SVM and tree ensemble (possibly for random forest, boosted trees, etc.) - Data processing utilities e.g. imputing missing values, one-hot encoding The complete listing for ONNX and ONNX-ML operator sets can be found here: - ONNX: https://github.com/onnx/onnx/blob/master/docs/Operators.md - ONNX-ML: https://github.com/onnx/onnx/blob/master/docs/Operators-
  • 6. Symbol Table Formatting - Represented as text file containing model structure - Should have standardized format, regardless of whether ONNX or some other format (e.g. Caffe) is being used to generate the table.
  • 7. Symbol Table Formatting ONNX Format Symbol Table Format
  • 8. Protobuf Encoding of .onnx - Model information is stored in an .onnx file as a binary following onnx.proto3 format - Needs a .proto file in order to decode the binary. A .proto has definitions for classes (e.g. models, graphs, nodes, etc.) - Must be compiled in terminal using the protoc command, generating a source file that can be imported
  • 9. Protobuf Encoding of .onnx - After .onnx binary is loaded in to an appropriate object in your source file (onnx.ModelProto object in the python script) - Relevant attributes are filled in and the object ready for use Loading the ONNX Model
  • 10. Step-by-step of ONNX model loading ● Gather the .onnx (model stored as binary) and .proto (class definition used to decode the .onnx) ● Compile the .proto into a (.py or other language) source file ○ Command: protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/[filename].[proto/proto3] ○ For example: protoc -I=. --python_out=. ./onnx.proto3 ● (Working in .py file now, not terminal) Import source file created by protoc ○ Source file should be in ./onnx/proto3_pb2.py; add an empty __init__.py inside ./onnx to allow python to recognize proto3_pb2.py as an importable library ○ In python: from onnx import proto3_pb2
  • 11. Step-by-step of ONNX model loading ● Create template variable to be filled in with data from the .onnx binary ○ In python: model = proto3_pb2.ModelProto() ● Load in the data from the binary ○ In python: with open(“model.onnx”, “rb”) as f: model.ParseFromString(f.read()) At this point model can be accessed like a regular object, e.g. use model.graph.node to get a list of nodes.
  • 12. ONNX model structure A .onnx file is organized in the following hierarchy: All possible attributes of the model, graph, node objects, etc. are described in the onnx.proto3 file.
  • 13. ONNX Graph Paradigm - Similarly to TensorFlow and some other frameworks, ONNX represents a model as a computational graph (example image on next page) - Operations like addition, activation functions (e.g. ReLU), convolutional layers, etc. are represented as nodes in the computational graph
  • 14. Sample Computation Graph - Graph on right displays flow of operations from input to output - This information is represented in .onnx file
  • 15. Functions of ONNX Classes ● Model ○ Overarching class; the entire .onnx file describes a single model ○ Basically a wrapper for a graph object + metadata (such as version of the ONNX representation, and the operator set version) ● Graph ○ Collection of elements that make up the computational graph ○ The graph object is what you might think of as the ML model, i.e. a neural network that takes in inputs and computes outputs
  • 16. Functions of ONNX Classes ● Node ○ Each node in the graph represents an operation, such as max pooling, reshaping a tensor, adding a bias, etc. ○ In ONNX, is represented by the op_type, inputs, and outputs, along with any attributes necessary to perform the operation (e.g. stride for a maxpool op) ● Input/Output ○ Primarily composed of some metadata (tensor name, docstrings) + Tensor object, which contains the type (int32, float, etc.) and tensor dimensions
  • 18. Testing ● A set of test cases with expected outputs will be created to verify that there are no bugs or missing components in current or future versions of the symbol table generator. ● Around 50 test cases is the target, including some common CNN architectures (ResNet, GoogLeNet, etc.)
  • 19. Next Steps Proposal ● Testing ○ Writing test cases to verify parser is working ○ Integration into github (CI) ● Next components in the compiler pipeline ○ Research on LLVM and processing the symbol table

Editor's Notes

  1. Notes: Model: Contains a graph and some metadata (like the ONNX IR version, and version of the operators used in the graph) Graph: Contains nodes (operators), inputs, outputs, and initializers