Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymbolic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lawrence Mitchell
pymbolic
Commits
38f05a83
Commit
38f05a83
authored
10 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Py3 fix
parent
d7223eea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pymbolic/mapper/constant_folder.py
+4
-7
4 additions, 7 deletions
pymbolic/mapper/constant_folder.py
with
4 additions
and
7 deletions
pymbolic/mapper/constant_folder.py
+
4
−
7
View file @
38f05a83
...
...
@@ -22,13 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
from
six.moves
import
reduce
from
pymbolic.mapper
import
\
IdentityMapper
,
\
CSECachingMapperMixin
class
ConstantFoldingMapperBase
(
object
):
def
is_constant
(
self
,
expr
):
from
pymbolic.mapper.dependency
import
DependencyMapper
...
...
@@ -75,7 +74,6 @@ class ConstantFoldingMapperBase(object):
return
self
.
fold
(
expr
,
Sum
,
operator
.
add
,
flattened_sum
)
class
CommutativeConstantFoldingMapperBase
(
ConstantFoldingMapperBase
):
def
map_product
(
self
,
expr
):
from
pymbolic.primitives
import
Product
,
flattened_product
...
...
@@ -84,16 +82,15 @@ class CommutativeConstantFoldingMapperBase(ConstantFoldingMapperBase):
return
self
.
fold
(
expr
,
Product
,
operator
.
mul
,
flattened_product
)
class
ConstantFoldingMapper
(
CSECachingMapperMixin
,
ConstantFoldingMapperBase
,
CSECachingMapperMixin
,
ConstantFoldingMapperBase
,
IdentityMapper
):
map_common_subexpression_uncached
=
\
IdentityMapper
.
map_common_subexpression
class
CommutativeConstantFoldingMapper
(
CSECachingMapperMixin
,
CommutativeConstantFoldingMapperBase
,
...
...
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