Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arraycontext
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
arraycontext
Commits
9109363d
Commit
9109363d
authored
2 years ago
by
Mike Campbell
Committed by
Andreas Klöckner
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add ArrayContext.freeze_thaw
parent
0569eab0
No related branches found
No related tags found
No related merge requests found
Pipeline
#310717
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arraycontext/context.py
+15
-0
15 additions, 0 deletions
arraycontext/context.py
with
15 additions
and
0 deletions
arraycontext/context.py
+
15
−
0
View file @
9109363d
...
...
@@ -269,6 +269,7 @@ class ArrayContext(ABC):
.. automethod:: freeze
.. automethod:: thaw
.. automethod:: freeze_thaw
.. automethod:: tag
.. automethod:: tag_axis
.. automethod:: compile
...
...
@@ -369,6 +370,20 @@ class ArrayContext(ABC):
See also :func:`arraycontext.thaw`.
"""
def
freeze_thaw
(
self
,
array
:
ArrayOrContainerOrScalarT
)
->
ArrayOrContainerOrScalarT
:
r
"""
Evaluate an input array or container to
"
frozen
"
data return a new
"
thawed
"
array or container representing the evaluation result that is
ready for use. This is a shortcut for calling :meth:`freeze` and
:meth:`thaw`.
This method can be useful in array contexts backed by, e.g.
:mod:`pytato`, to force the evaluation of a built-up array expression
(and thereby avoid reevaluations for expressions built on the array).
"""
return
self
.
thaw
(
self
.
freeze
(
array
))
@abstractmethod
def
tag
(
self
,
tags
:
ToTagSetConvertible
,
...
...
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