Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SimRA
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guilhem Gamard
SimRA
Commits
93af8ea9
Commit
93af8ea9
authored
5 years ago
by
Guilhem Gamard
Browse files
Options
Downloads
Patches
Plain Diff
Fixed node_constant
parent
d0da03de
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
simra.py
+10
-1
10 additions, 1 deletion
simra.py
with
10 additions
and
1 deletion
simra.py
+
10
−
1
View file @
93af8ea9
...
...
@@ -236,15 +236,24 @@ def periodic_mode(mode):
# Trivial nodes
def
node_fixpoint
(
name
,
init_val
=
0
):
"""
Return a node that depends only on itself and updates to its own value.
"""
def
identity
(
args
):
for
k
in
args
.
keys
():
return
args
[
k
]
return
Node
(
name
,
identity
,
[
name
],
init_val
)
def
node_constant
(
name
,
value
=
0
,
init_val
=
value
):
def
node_constant
(
name
,
value
=
0
,
init_val
=
None
):
"""
Return a node that depends on nobody and update to the given value.
"""
if
not
init_val
:
init_val
=
value
def
constant
(
args
):
nonlocal
value
return
value
return
Node
(
name
,
constant
,
[],
init_val
)
# ################################################################
...
...
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