Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pystencils_autodiff
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
pycodegen
pystencils_autodiff
Commits
cb78f5f8
Commit
cb78f5f8
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Export pystencils_autodiff.show_code{,_debug}
parent
47f72700
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pystencils_autodiff/__init__.py
+4
-1
4 additions, 1 deletion
src/pystencils_autodiff/__init__.py
src/pystencils_autodiff/framework_integration/printer.py
+6
-0
6 additions, 0 deletions
src/pystencils_autodiff/framework_integration/printer.py
with
10 additions
and
1 deletion
src/pystencils_autodiff/__init__.py
+
4
−
1
View file @
cb78f5f8
...
@@ -8,6 +8,7 @@ from pystencils_autodiff._autodiff import (
...
@@ -8,6 +8,7 @@ from pystencils_autodiff._autodiff import (
AutoDiffAstPair
,
AutoDiffBoundaryHandling
,
AutoDiffOp
,
DiffModes
,
create_backward_assignments
,
AutoDiffAstPair
,
AutoDiffBoundaryHandling
,
AutoDiffOp
,
DiffModes
,
create_backward_assignments
,
get_jacobian_of_assignments
)
get_jacobian_of_assignments
)
from
pystencils_autodiff.field_tensor_conversion
import
ArrayWrapper
,
coerce_to_field
from
pystencils_autodiff.field_tensor_conversion
import
ArrayWrapper
,
coerce_to_field
from
pystencils_autodiff.framework_integration.printer
import
show_code
,
show_code_debug
__all__
=
[
'
backends
'
,
__all__
=
[
'
backends
'
,
'
AdjointField
'
,
'
AdjointField
'
,
...
@@ -19,7 +20,9 @@ __all__ = ['backends',
...
@@ -19,7 +20,9 @@ __all__ = ['backends',
'
DiffModes
'
,
'
DiffModes
'
,
'
AutoDiffBoundaryHandling
'
,
'
AutoDiffBoundaryHandling
'
,
'
ArrayWrapper
'
,
'
ArrayWrapper
'
,
'
coerce_to_field
'
]
'
coerce_to_field
'
,
'
show_code
'
,
'
show_code_debug
'
]
sys
.
modules
[
'
pystencils.autodiff
'
]
=
pystencils_autodiff
sys
.
modules
[
'
pystencils.autodiff
'
]
=
pystencils_autodiff
sys
.
modules
[
'
pystencils.autodiff.backends
'
]
=
pystencils_autodiff
.
backends
sys
.
modules
[
'
pystencils.autodiff.backends
'
]
=
pystencils_autodiff
.
backends
This diff is collapsed.
Click to expand it.
src/pystencils_autodiff/framework_integration/printer.py
+
6
−
0
View file @
cb78f5f8
import
functools
import
sympy
as
sp
import
sympy
as
sp
import
pystencils.backends.cbackend
import
pystencils.backends.cbackend
...
@@ -165,3 +167,7 @@ class DebugFrameworkPrinter(FrameworkIntegrationPrinter):
...
@@ -165,3 +167,7 @@ class DebugFrameworkPrinter(FrameworkIntegrationPrinter):
return
super
().
_print
(
node
)
+
f
'
/*
{
node
.
__class__
.
__name__
}
symbols_undefined:
{
node
.
undefined_symbols
}
, symbols_defined:
{
node
.
symbols_defined
}
, args
{
[
a
if
isinstance
(
a
,
str
)
else
a
.
__class__
.
__name__
for
a
in
node
.
args
]
}
*/
'
# noqa
return
super
().
_print
(
node
)
+
f
'
/*
{
node
.
__class__
.
__name__
}
symbols_undefined:
{
node
.
undefined_symbols
}
, symbols_defined:
{
node
.
symbols_defined
}
, args
{
[
a
if
isinstance
(
a
,
str
)
else
a
.
__class__
.
__name__
for
a
in
node
.
args
]
}
*/
'
# noqa
else
:
else
:
return
super
().
_print
(
node
)
return
super
().
_print
(
node
)
show_code
=
functools
.
partial
(
pystencils
.
show_code
,
custom_backend
=
FrameworkIntegrationPrinter
())
show_code_debug
=
functools
.
partial
(
pystencils
.
show_code
,
custom_backend
=
DebugFrameworkPrinter
())
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