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
34c303c5
Commit
34c303c5
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Add ast properties to pystencils_autodiff.AutoDiffOp
parent
e53ba81a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#18044
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencils_autodiff/_autodiff.py
+28
-8
28 additions, 8 deletions
src/pystencils_autodiff/_autodiff.py
with
28 additions
and
8 deletions
src/pystencils_autodiff/_autodiff.py
+
28
−
8
View file @
34c303c5
...
@@ -365,32 +365,52 @@ Backward:
...
@@ -365,32 +365,52 @@ Backward:
def
backward_read_accesses
(
self
):
def
backward_read_accesses
(
self
):
return
[
a
for
a
in
self
.
backward_assignments
.
free_symbols
if
isinstance
(
a
,
ps
.
Field
.
Access
)]
return
[
a
for
a
in
self
.
backward_assignments
.
free_symbols
if
isinstance
(
a
,
ps
.
Field
.
Access
)]
@property
def
forward_ast_cpu
(
self
):
if
not
self
.
_forward_ast_cpu
:
self
.
_forward_ast_cpu
=
ps
.
create_kernel
(
self
.
_forward_assignments
,
**
self
.
_kwargs
)
return
self
.
_forward_ast_cpu
@property
def
forward_ast_gpu
(
self
):
if
not
self
.
_forward_ast_gpu
:
self
.
_forward_ast_gpu
=
ps
.
create_kernel
(
self
.
_forward_assignments
,
target
=
'
gpu
'
,
**
self
.
_kwargs
)
return
self
.
_forward_ast_gpu
@property
def
backward_ast_cpu
(
self
):
if
not
self
.
_backward_ast_cpu
:
self
.
_backward_ast_cpu
=
ps
.
create_kernel
(
self
.
_backward_assignments
,
target
=
'
cpu
'
,
**
self
.
_kwargs
)
return
self
.
_backward_ast_cpu
@property
def
backward_ast_gpu
(
self
):
if
not
self
.
_backward_ast_gpu
:
self
.
_backward_ast_gpu
=
ps
.
create_kernel
(
self
.
_backward_assignments
,
target
=
'
gpu
'
,
**
self
.
_kwargs
)
return
self
.
_backward_ast_gpu
@property
@property
def
forward_kernel_cpu
(
self
):
def
forward_kernel_cpu
(
self
):
if
not
self
.
_forward_kernel_cpu
:
if
not
self
.
_forward_kernel_cpu
:
self
.
_forward_kernel_cpu
=
ps
.
create_kernel
(
self
.
_forward_kernel_cpu
=
self
.
forward_ast_cpu
.
compile
()
self
.
_forward_assignments
,
**
self
.
_kwargs
).
compile
()
return
self
.
_forward_kernel_cpu
return
self
.
_forward_kernel_cpu
@property
@property
def
forward_kernel_gpu
(
self
):
def
forward_kernel_gpu
(
self
):
if
not
self
.
_forward_kernel_gpu
:
if
not
self
.
_forward_kernel_gpu
:
self
.
_forward_kernel_gpu
=
ps
.
create_kernel
(
self
.
_forward_kernel_gpu
=
self
.
forward_ast_gpu
.
compile
()
self
.
_forward_assignments
,
target
=
'
gpu
'
,
**
self
.
_kwargs
).
compile
()
return
self
.
_forward_kernel_gpu
return
self
.
_forward_kernel_gpu
@property
@property
def
backward_kernel_cpu
(
self
):
def
backward_kernel_cpu
(
self
):
if
not
self
.
_backward_kernel_cpu
:
if
not
self
.
_backward_kernel_cpu
:
self
.
_backward_kernel_cpu
=
ps
.
create_kernel
(
self
.
_backward_kernel_cpu
=
self
.
backward_ast_cpu
.
compile
()
self
.
_backward_assignments
,
target
=
'
cpu
'
,
**
self
.
_kwargs
).
compile
()
return
self
.
_backward_kernel_cpu
return
self
.
_backward_kernel_cpu
@property
@property
def
backward_kernel_gpu
(
self
):
def
backward_kernel_gpu
(
self
):
if
not
self
.
_backward_kernel_gpu
:
if
not
self
.
_backward_kernel_gpu
:
self
.
_backward_kernel_gpu
=
ps
.
create_kernel
(
self
.
_backward_kernel_gpu
=
self
.
backward_ast_gpu
.
compile
()
self
.
_backward_assignments
,
target
=
'
gpu
'
,
**
self
.
_kwargs
).
compile
()
return
self
.
_backward_kernel_gpu
return
self
.
_backward_kernel_gpu
@property
@property
...
...
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