Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pycodegen
pystencils_autodiff
Commits
20f2ee40
Commit
20f2ee40
authored
Dec 02, 2019
by
Stephan Seitz
Browse files
Fixup: allow time_constant_fields == None
parent
8b7bdb96
Pipeline
#20185
failed with stage
in 1 minute and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/pystencils_autodiff/_autodiff.py
View file @
20f2ee40
...
...
@@ -85,7 +85,7 @@ def _create_backward_assignments_tf_mad(self, diff_fields_prefix):
w
in
zip
(
ra
.
offsets
,
forward_assignment
.
lhs
.
offsets
))
diff_read_field_sum
+=
sp
.
diff
(
forward_assignment
.
rhs
,
ra
)
*
\
diff_write_field
[
inverted_offset
](
*
diff_write_index
)
if
forward_read_field
in
self
.
_time_constant_fields
and
self
.
time_constant_fields
is
not
None
:
if
self
.
time_constant_fields
is
not
None
and
forward_read_field
in
self
.
_time_constant_fields
:
# Accumulate in case of time_constant_fields
assignment
=
ps
.
Assignment
(
diff_read_field
.
center
(),
diff_read_field
.
center
()
+
diff_read_field_sum
)
...
...
@@ -368,7 +368,7 @@ Backward:
rhs
=
rhs
[
0
,
0
]
# if field is constant over we time we can accumulate in assignment
if
read_access
.
field
in
self
.
_time_constant_fields
and
self
.
time_constant_fields
is
not
None
:
if
self
.
time_constant_fields
is
not
None
and
read_access
.
field
in
self
.
_time_constant_fields
:
backward_assignments
.
append
(
ps
.
Assignment
(
lhs
,
lhs
+
rhs
))
else
:
backward_assignments
.
append
(
ps
.
Assignment
(
lhs
,
rhs
))
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment