Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
b3745772
Commit
b3745772
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Fixed GPU import
parent
2556d843
No related branches found
No related tags found
1 merge request
!275
WIP: Revamp the type system
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/notebooks/01_tutorial_getting_started.ipynb
+892
-81
892 additions, 81 deletions
doc/notebooks/01_tutorial_getting_started.ipynb
pystencils/backends/dot.py
+7
-2
7 additions, 2 deletions
pystencils/backends/dot.py
pystencils/display_utils.py
+6
-1
6 additions, 1 deletion
pystencils/display_utils.py
with
905 additions
and
84 deletions
doc/notebooks/01_tutorial_getting_started.ipynb
+
892
−
81
View file @
b3745772
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
pystencils/backends/dot.py
+
7
−
2
View file @
b3745772
import
graphviz
import
graphviz
from
graphviz
import
Digraph
,
lang
try
:
from
graphviz
import
Digraph
import
graphviz.quoting
as
quote
except
ImportError
:
from
graphviz
import
Digraph
import
graphviz.lang
as
quote
from
sympy.printing.printer
import
Printer
from
sympy.printing.printer
import
Printer
...
@@ -12,7 +17,7 @@ class DotPrinter(Printer):
...
@@ -12,7 +17,7 @@ class DotPrinter(Printer):
super
(
DotPrinter
,
self
).
__init__
()
super
(
DotPrinter
,
self
).
__init__
()
self
.
_node_to_str_function
=
node_to_str_function
self
.
_node_to_str_function
=
node_to_str_function
self
.
dot
=
Digraph
(
**
kwargs
)
self
.
dot
=
Digraph
(
**
kwargs
)
self
.
dot
.
quote_edge
=
lang
.
quote
self
.
dot
.
quote_edge
=
quote
.
quote
def
_print_KernelFunction
(
self
,
func
):
def
_print_KernelFunction
(
self
,
func
):
self
.
dot
.
node
(
str
(
id
(
func
)),
style
=
'
filled
'
,
fillcolor
=
'
#a056db
'
,
label
=
self
.
_node_to_str_function
(
func
))
self
.
dot
.
node
(
str
(
id
(
func
)),
style
=
'
filled
'
,
fillcolor
=
'
#a056db
'
,
label
=
self
.
_node_to_str_function
(
func
))
...
...
This diff is collapsed.
Click to expand it.
pystencils/display_utils.py
+
6
−
1
View file @
b3745772
...
@@ -10,7 +10,12 @@ from pystencils.kernel_wrapper import KernelWrapper
...
@@ -10,7 +10,12 @@ from pystencils.kernel_wrapper import KernelWrapper
def
to_dot
(
expr
:
sp
.
Expr
,
graph_style
:
Optional
[
Dict
[
str
,
Any
]]
=
None
,
short
=
True
):
def
to_dot
(
expr
:
sp
.
Expr
,
graph_style
:
Optional
[
Dict
[
str
,
Any
]]
=
None
,
short
=
True
):
"""
Show a sympy or pystencils AST as dot graph
"""
"""
Show a sympy or pystencils AST as dot graph
"""
from
pystencils.astnodes
import
Node
from
pystencils.astnodes
import
Node
import
graphviz
try
:
import
graphviz
except
ImportError
:
print
(
"
graphviz is not installed. Visualizing the AST is not available
"
)
return
graph_style
=
{}
if
graph_style
is
None
else
graph_style
graph_style
=
{}
if
graph_style
is
None
else
graph_style
if
isinstance
(
expr
,
Node
):
if
isinstance
(
expr
,
Node
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment