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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Christoph Alt
pystencils
Commits
e4766ca5
Commit
e4766ca5
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Implemented sp.Indexed
parent
e10f45b7
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/cache.py
+4
-2
4 additions, 2 deletions
pystencils/cache.py
pystencils/typing/leaf_typing.py
+2
-1
2 additions, 1 deletion
pystencils/typing/leaf_typing.py
with
6 additions
and
3 deletions
pystencils/cache.py
+
4
−
2
View file @
e4766ca5
import
os
import
os
from
collections.abc
import
Hashable
from
collections.abc
import
Hashable
from
functools
import
partial
,
wraps
,
lru_cache
from
functools
import
partial
,
wraps
from
itertools
import
chain
from
itertools
import
chain
from
functools
import
lru_cache
as
memorycache
from
joblib
import
Memory
from
joblib
import
Memory
from
appdirs
import
user_cache_dir
from
appdirs
import
user_cache_dir
...
@@ -23,7 +25,7 @@ def _wrapper(wrapped_func, cached_func, *args, **kwargs):
...
@@ -23,7 +25,7 @@ def _wrapper(wrapped_func, cached_func, *args, **kwargs):
def
memorycache_if_hashable
(
maxsize
=
128
,
typed
=
False
):
def
memorycache_if_hashable
(
maxsize
=
128
,
typed
=
False
):
def
wrapper
(
func
):
def
wrapper
(
func
):
return
partial
(
_wrapper
,
func
,
lru_
cache
(
maxsize
,
typed
)(
func
))
return
partial
(
_wrapper
,
func
,
memory
cache
(
maxsize
,
typed
)(
func
))
return
wrapper
return
wrapper
...
...
This diff is collapsed.
Click to expand it.
pystencils/typing/leaf_typing.py
+
2
−
1
View file @
e4766ca5
...
@@ -190,7 +190,8 @@ class TypeAdder:
...
@@ -190,7 +190,8 @@ class TypeAdder:
# # TODO can we ignore this and move it to general expr handling, i.e. removing Mul? (See todo in backend)
# # TODO can we ignore this and move it to general expr handling, i.e. removing Mul? (See todo in backend)
# # args_types = [self.figure_out_type(arg) for arg in expr.args if arg not in (-1, 1)]
# # args_types = [self.figure_out_type(arg) for arg in expr.args if arg not in (-1, 1)]
elif
isinstance
(
expr
,
sp
.
Indexed
):
elif
isinstance
(
expr
,
sp
.
Indexed
):
raise
NotImplementedError
(
'
sp.Indexed
'
)
typed_symbol
=
expr
.
base
.
label
return
expr
,
typed_symbol
.
dtype
elif
isinstance
(
expr
,
ExprCondPair
):
elif
isinstance
(
expr
,
ExprCondPair
):
expr_expr
,
expr_type
=
self
.
figure_out_type
(
expr
.
expr
)
expr_expr
,
expr_type
=
self
.
figure_out_type
(
expr
.
expr
)
condition
,
condition_type
=
self
.
figure_out_type
(
expr
.
cond
)
condition
,
condition_type
=
self
.
figure_out_type
(
expr
.
cond
)
...
...
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