Skip to content

Commit

Permalink
add image to docs and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
4imothy committed Oct 2, 2024
1 parent 405ae08 commit 7676dce
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 6 deletions.
Binary file added docs/_static/framework_overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def run(self):
doctest_global_setup = '''
import ai3
import torch
from torch import nn
import torchvision
from example.manual_conv2d import ConvNet
'''
Expand Down
128 changes: 128 additions & 0 deletions docs/framework_overview.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:130.0) Gecko/20100101 Firefox/130.0" version="24.7.15">
<diagram name="Page-1" id="qCadsNzABqGTmcjrxvg6">
<mxGraphModel dx="1429" dy="1125" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="850" pageHeight="1100" background="none" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="VA1LnyZjXGl7gneg4ioU-150" value="" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;strokeColor=#000000;fontColor=#000000;fontSize=13;fontStyle=0;comic=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontFamily=Lucida Console;labelBorderColor=none;textShadow=0;" parent="1" source="VA1LnyZjXGl7gneg4ioU-59" target="VA1LnyZjXGl7gneg4ioU-149" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="542" y="384" as="sourcePoint" />
<mxPoint x="543" y="415" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-59" value="ai3.swap_operation(X, &lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;orig_model&lt;/span&gt;&lt;/font&gt;, algos)" style="swimlane;html=1;labelBackgroundColor=none;fillColor=#f2f2eb;strokeColor=#000000;fontSize=13;swimlaneFillColor=#f2f3f4;rounded=1;fontStyle=0;comic=0;portConstraintRotation=0;dropTarget=1;collapsible=0;fontFamily=Lucida Console;fontColor=#000000;labelBorderColor=none;textShadow=0;" parent="1" vertex="1">
<mxGeometry x="160" y="125" width="440" height="54" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-21" value="ai3.swap_torch.X" style="edgeLabel;resizable=0;html=1;;align=left;verticalAlign=bottom;labelBackgroundColor=none;fontColor=#000000;fontSize=13;fontStyle=0;comic=0;fontFamily=Lucida Console;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-59" connectable="0" vertex="1">
<mxGeometry x="279" y="45" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-39" value="torch.nn.X" style="edgeLabel;resizable=0;html=1;;align=left;verticalAlign=bottom;labelBackgroundColor=none;fontColor=#000000;fontSize=13;fontStyle=0;comic=0;fontFamily=Lucida Console;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-59" connectable="0" vertex="1">
<mxGeometry x="68" y="45" as="geometry" />
</mxCell>
<mxCell id="-o_ASug0oNMI49kCHFPn-1" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" edge="1" parent="VA1LnyZjXGl7gneg4ioU-59">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="180" y="37" as="sourcePoint" />
<mxPoint x="260" y="37" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-60" value="ai3_model = ai3.swap_backend(&lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;orig_model&lt;/span&gt;&lt;/font&gt;, algos)" style="swimlane;html=1;labelBackgroundColor=none;fillColor=#f2f2eb;strokeColor=#000000;fontSize=13;rounded=1;fontFamily=Lucida Console;gradientColor=none;swimlaneFillColor=#f2f3f4;fontStyle=0;comic=0;collapsible=0;fontColor=#000000;labelBorderColor=none;textShadow=0;" parent="1" vertex="1">
<mxGeometry x="-270" y="125" width="420" height="140" as="geometry">
<mxRectangle x="397" y="157" width="361" height="26" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-49" value="&lt;div&gt;ai3.Model&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ai3.layers.Conv2D&lt;br&gt;ai3.layers.Linear&lt;br&gt;ai3.layers.MaxPool2D&lt;br&gt;ai3.layers.X&lt;/div&gt;" style="edgeLabel;resizable=0;html=1;;align=left;verticalAlign=bottom;labelBackgroundColor=none;fontColor=#000000;fontSize=13;fontStyle=0;comic=0;fontFamily=Lucida Console;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" connectable="0" vertex="1">
<mxGeometry x="253" y="127" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-90" value="" style="strokeWidth=1;html=1;shape=mxgraph.flowchart.annotation_2;align=left;labelPosition=right;pointerEvents=1;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;rotation=90;fontSize=10;fontStyle=0;comic=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" vertex="1">
<mxGeometry x="204" y="-146.75" width="12" height="400" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-107" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="170" y="42" as="sourcePoint" />
<mxPoint x="250" y="42" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-54" value="&lt;div&gt;torch.nn.Module&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;torch.nn.Conv2d&lt;/div&gt;torch.nn.Linear&lt;br&gt;torch.nn.MaxPool2d&lt;br&gt;torch.nn.X" style="edgeLabel;resizable=0;html=1;;align=right;verticalAlign=bottom;labelBackgroundColor=none;fontColor=#000000;fontSize=13;fontStyle=0;comic=0;fontFamily=Lucida Console;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" connectable="0" vertex="1">
<mxGeometry x="160" y="127" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-109" value="" style="strokeWidth=1;html=1;shape=mxgraph.flowchart.annotation_1;align=left;pointerEvents=1;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;enumerate=0;comic=0;direction=west;sketch=1;curveFitting=1;jiggle=2;sketchStyle=rough;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" vertex="1">
<mxGeometry x="403" y="67" width="14" height="65" as="geometry" />
</mxCell>
<mxCell id="rlVCM665_IfpjGgolWaw-1" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="170" y="74" as="sourcePoint" />
<mxPoint x="250" y="74" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="rlVCM665_IfpjGgolWaw-2" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="170" y="89" as="sourcePoint" />
<mxPoint x="250" y="89" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="rlVCM665_IfpjGgolWaw-7" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="170" y="104" as="sourcePoint" />
<mxPoint x="250" y="104" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="rlVCM665_IfpjGgolWaw-8" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="VA1LnyZjXGl7gneg4ioU-60" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="170" y="119" as="sourcePoint" />
<mxPoint x="250" y="119" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-73" value="&lt;p style=&quot;line-height: 110%; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;div style=&quot;font-size: 13px; line-height: 100%;&quot; align=&quot;left&quot;&gt;&lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;import torch&lt;br style=&quot;font-size: 13px;&quot;&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 100%;&quot; align=&quot;left&quot;&gt;&lt;div style=&quot;font-size: 13px; line-height: 100%;&quot; align=&quot;left&quot;&gt;&lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;import ai3 &lt;font color=&quot;#666666&quot; style=&quot;font-size: 13px;&quot;&gt;# the framework&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 100%;&quot; align=&quot;left&quot;&gt;&lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;...&lt;br&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 100%;&quot; align=&quot;left&quot;&gt;&lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;&lt;br style=&quot;font-size: 13px;&quot;&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 100%;&quot; align=&quot;left&quot;&gt;&lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;orig_model: torch.nn.Module = Model()&lt;br&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;div style=&quot;font-size: 13px; line-height: 100%;&quot; align=&quot;left&quot;&gt;&lt;font&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;algos: ai3.AlgorithmicSelector = ...&lt;br style=&quot;font-size: 13px;&quot;&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;" style="rounded=1;html=1;labelBackgroundColor=none;fillColor=#F2F2EA;strokeColor=#696969;fontColor=#000000;fontSize=13;gradientColor=none;fontStyle=0;comic=0;movable=1;treeFolding=0;treeMoving=0;fontFamily=Lucida Console;labelBorderColor=none;textShadow=0;verticalAlign=bottom;" parent="1" vertex="1">
<mxGeometry x="12" y="-13" width="302" height="83" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-84" value="&lt;span style=&quot;font-size: 13px;&quot;&gt;pred: torch.Tensor = ai3_model(input)&lt;br style=&quot;font-size: 13px;&quot;&gt;&lt;/span&gt;" style="rounded=1;html=1;labelBackgroundColor=none;fillColor=#F2F2EA;strokeColor=#000000;fontColor=#000000;fontSize=13;glass=0;fontStyle=0;fontFamily=Lucida Console;comic=0;labelBorderColor=none;textShadow=0;" parent="1" vertex="1">
<mxGeometry x="-210" y="300" width="300" height="28" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-87" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;labelBackgroundColor=none;strokeColor=#000000;fontColor=#000000;fontSize=13;fontStyle=0;comic=0;fontFamily=Lucida Console;labelBorderColor=none;textShadow=0;" parent="1" source="VA1LnyZjXGl7gneg4ioU-60" target="VA1LnyZjXGl7gneg4ioU-84" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-150.01" y="317" as="sourcePoint" />
<mxPoint x="-151.01" y="452" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-112" value="" style="endArrow=classic;html=1;rounded=1;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;strokeWidth=1;sketch=1;curveFitting=1;jiggle=2;curved=0;exitPerimeter=0;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="1" source="VA1LnyZjXGl7gneg4ioU-109" target="VA1LnyZjXGl7gneg4ioU-65" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="645" y="494" as="sourcePoint" />
<mxPoint x="695" y="444" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-114" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;entryX=1;entryY=0.5;entryDx=0;entryDy=0;strokeWidth=1;sketch=1;curveFitting=1;jiggle=2;curved=1;comic=0;fontStyle=0;fontFamily=Lucida Console;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="1" target="VA1LnyZjXGl7gneg4ioU-65" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="497" y="175" as="sourcePoint" />
<mxPoint x="794" y="379" as="targetPoint" />
<Array as="points">
<mxPoint x="427" y="225" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-149" value="pred: torch.Tensor = orig_model(input)" style="rounded=1;html=1;labelBackgroundColor=none;fillColor=#F2F2EA;strokeColor=#000000;fontColor=#000000;fontSize=13;glass=0;fontStyle=0;fontFamily=Lucida Console;comic=0;labelBorderColor=none;textShadow=0;" parent="1" vertex="1">
<mxGeometry x="230" y="300" width="300" height="28" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-65" value="&lt;font&gt;&lt;i&gt;C++&lt;/i&gt; implementation of the algorithm selected by user&lt;/font&gt;" style="rounded=1;html=1;fillColor=#cbcee1;strokeColor=#56517e;fontSize=13;shadow=0;fontStyle=0;comic=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Comic Sans MS;fontColor=#000000;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;whiteSpace=wrap;sketchStyle=comic;" parent="1" vertex="1">
<mxGeometry x="180" y="200" width="148.25" height="59" as="geometry" />
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-154" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="VA1LnyZjXGl7gneg4ioU-73" target="VA1LnyZjXGl7gneg4ioU-59" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="398" y="379" as="sourcePoint" />
<mxPoint x="367" y="92" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-156" value="" style="endArrow=classic;html=1;rounded=0;strokeColor=#000000;fontColor=#000000;fillColor=#FAE5C7;exitX=0.25;exitY=1;exitDx=0;exitDy=0;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="VA1LnyZjXGl7gneg4ioU-73" target="VA1LnyZjXGl7gneg4ioU-60" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="178" y="206" as="sourcePoint" />
<mxPoint x="-74" y="74" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="VA1LnyZjXGl7gneg4ioU-157" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;strokeColor=#A8201A;fontColor=#000000;fillColor=#FAE5C7;labelBackgroundColor=none;labelBorderColor=none;textShadow=0;" parent="1" source="VA1LnyZjXGl7gneg4ioU-84" target="VA1LnyZjXGl7gneg4ioU-84" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
12 changes: 6 additions & 6 deletions docs/gen_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def clean_rst_prolog():


if __name__ == '__main__':
with open(os.path.join('docs', 'intro.rst'), 'r') as index_file:
index_content = index_file.read()
with open(os.path.join('docs', 'algo_platform_tables.rst'), 'r') as index_file:
algo_platform_tables = index_file.read()
with open(os.path.join('docs', 'intro.rst'), 'r') as file:
index_content = file.read().replace('_static/', 'docs/_static/')
with open(os.path.join('docs', 'algo_platform_tables.rst'), 'r') as file:
algo_platform_tables = file.read()
with open('README.rst', 'w') as readme_file:
readme_file.write(clean_rst_prolog())
readme_file.write('\n')
Expand All @@ -47,9 +47,9 @@ def clean_rst_prolog():
readme_file.write(''.join(doc.splitlines(keepends=True)[1:]))
readme_file.write('\n\n')

sc_doc = prune_rst_links_and_remove_args(ai3.swap_conv2d)
sc_doc = prune_rst_links_and_remove_args(ai3.swap_operation)

readme_file.writelines(['*swap_conv2d*\n',
readme_file.writelines(['*swap_operation*\n',
'~~~~~~~~~~~~~\n',
sc_doc])
readme_file.write('\n\n')
Expand Down

0 comments on commit 7676dce

Please sign in to comment.