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
Alexander Reinauer
pystencils
Commits
b9d654ae
Commit
b9d654ae
authored
3 years ago
by
Markus Holzer
Committed by
Jan Hönig
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Revision3
parent
f38af3f3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pystencils/transformations.py
+1
-0
1 addition, 0 deletions
pystencils/transformations.py
pystencils_tests/test_move_constant_before_loop.py
+3
-1
3 additions, 1 deletion
pystencils_tests/test_move_constant_before_loop.py
with
4 additions
and
1 deletion
pystencils/transformations.py
+
1
−
0
View file @
b9d654ae
...
...
@@ -638,6 +638,7 @@ def move_constants_before_loop(ast_node):
new_symbol
=
TypedSymbol
(
sp
.
Dummy
().
name
,
child
.
lhs
.
dtype
)
target
.
insert_before
(
ast
.
SympyAssignment
(
new_symbol
,
child
.
rhs
,
is_const
=
child
.
is_const
),
child_to_insert_before
)
block
.
append
(
ast
.
SympyAssignment
(
child
.
lhs
,
new_symbol
,
is_const
=
child
.
is_const
))
def
split_inner_loop
(
ast_node
:
ast
.
Node
,
symbol_groups
):
...
...
This diff is collapsed.
Click to expand it.
pystencils_tests/test_move_constant_before_loop.py
+
3
−
1
View file @
b9d654ae
...
...
@@ -25,7 +25,9 @@ def test_symbol_renaming():
loops
=
block
.
atoms
(
LoopOverCoordinate
)
assert
len
(
loops
)
==
2
assert
len
(
block
.
args
[
2
].
body
.
args
)
==
1
assert
len
(
block
.
args
[
3
].
body
.
args
)
==
2
for
loop
in
loops
:
assert
len
(
loop
.
body
.
args
)
==
1
assert
len
(
loop
.
parent
.
args
)
==
4
# 2 loops + 2 subexpressions
assert
loop
.
parent
.
args
[
0
].
lhs
.
name
!=
loop
.
parent
.
args
[
1
].
lhs
.
name
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