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
490ec914
Commit
490ec914
authored
2 months ago
by
Richard Angersbach
Browse files
Options
Downloads
Patches
Plain Diff
Omit old stuff from reduction_op_to_expr
parent
39483609
No related branches found
No related tags found
1 merge request
!438
Reduction Support
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencils/backend/reduction_op_mapping.py
+2
-10
2 additions, 10 deletions
src/pystencils/backend/reduction_op_mapping.py
with
2 additions
and
10 deletions
src/pystencils/backend/reduction_op_mapping.py
+
2
−
10
View file @
490ec914
from
.ast.expressions
import
PsExpression
,
PsCall
,
PsAdd
,
PsSub
,
PsMul
,
PsDiv
from
.exceptions
import
Freeze
Error
from
.exceptions
import
PsInternalCompiler
Error
from
.functions
import
PsMathFunction
,
MathFunctions
from
..sympyextensions.reduction
import
ReductionOp
_available_operator_interface
:
set
[
ReductionOp
]
=
{
ReductionOp
.
Add
,
ReductionOp
.
Sub
,
ReductionOp
.
Mul
,
ReductionOp
.
Div
,
}
def
reduction_op_to_expr
(
op
:
ReductionOp
,
op1
,
op2
)
->
PsExpression
:
match
op
:
case
ReductionOp
.
Add
:
...
...
@@ -26,6 +18,6 @@ def reduction_op_to_expr(op: ReductionOp, op1, op2) -> PsExpression:
case
ReductionOp
.
Max
:
return
PsCall
(
PsMathFunction
(
MathFunctions
.
Max
),
[
op1
,
op2
])
case
_
:
raise
Freeze
Error
(
raise
PsInternalCompiler
Error
(
f
"
Found unsupported operation type for reduction assignments:
{
op
}
.
"
)
This diff is collapsed.
Click to expand it.
Frederik Hennig
@da15siwa
mentioned in commit
4e688b86
·
2 months ago
mentioned in commit
4e688b86
mentioned in commit 4e688b867339c90a6fba3ad12c383d1e59211ed9
Toggle commit list
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