Skip to content

Cyclical graphs support #550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 50 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
407344b
Initial examples with cyclic graphs, enabled by default_value on inputs
pgleeson Nov 21, 2022
f06ac89
Merge branch 'nml_examples' into cyclic_graphs
pgleeson Nov 22, 2022
ffbfed4
Merge branch 'nml_examples' into cyclic_graphs
pgleeson Nov 23, 2022
b4cef5b
Merge branch 'development' into cyclic_graphs
pgleeson Dec 5, 2022
73b00ff
Merge branch 'development' into cyclic_graphs
pgleeson Jan 18, 2023
5edc1de
Simple net
pgleeson Jan 18, 2023
8bf3130
Tweaks to net example
pgleeson Jan 19, 2023
405da70
Merge branch 'development' into cyclic_graphs
pgleeson Jan 25, 2023
512f889
Merge branch 'development' into cyclic_graphs
Mar 16, 2023
4a5a45a
Regenerated
Mar 16, 2023
2418deb
Merge branch 'development' into cyclic_graphs
pgleeson Apr 19, 2023
f575dd2
Merge branch 'nml_examples' into cyclic_graphs
pgleeson Apr 19, 2023
9ec0dd5
Merge branch 'nml_examples' into cyclic_graphs
pgleeson Apr 25, 2023
a41935f
Update array png
pgleeson Apr 25, 2023
6b409a0
Add a reduce field on InputPort, defaulting currently to 'overwrite' …
pgleeson Apr 28, 2023
60bc027
Ensure graphs are always generated (on mac/linux) and don't silently …
pgleeson May 9, 2023
54cb858
Merge branch 'nml_examples' into cyclic_graphs
pgleeson May 10, 2023
51f7fef
Regenerated images
pgleeson May 10, 2023
d4a2c2f
Merge branch 'nml_examples' into cyclic_graphs
pgleeson May 11, 2023
4672605
Merge branch 'nml_examples' into cyclic_graphs
pgleeson May 12, 2023
ecd01d2
Test with latest modelspec; temporarily changing test on scheduler to…
pgleeson May 15, 2023
ab60980
Merge branch 'nml_examples' into cyclic_graphs
pgleeson May 15, 2023
546ac30
Merge branch 'nml_examples' into cyclic_graphs
pgleeson May 15, 2023
13fd9f8
Regenerated files with latest nmllite
pgleeson May 16, 2023
107511d
Merge branch 'nml_examples2' into cyclic_graphs
pgleeson May 19, 2023
a49ff5b
Regenerated images
pgleeson May 19, 2023
ba343c6
Merge branch 'nml_examples' into cyclic_graphs
pgleeson May 24, 2023
c4d1432
Merge branch 'development' into cyclic_graphs
pgleeson May 31, 2023
ae244bb
Merge branch 'development' into cyclic_graphs
pgleeson Jul 27, 2023
bdd84c8
Merge branch 'development' into cyclic_graphs
pgleeson Aug 15, 2023
d13fb52
Regenerated
pgleeson Aug 15, 2023
87bb845
Merge branch 'nml_examples' into cyclic_graphs
pgleeson Aug 15, 2023
7a5e237
Merge branch 'development' into cyclic_graphs
pgleeson Oct 25, 2023
dcf746e
Merge pull request #493 from ModECI/development
pgleeson Feb 1, 2024
a4945f7
Merge branch 'development' into cyclic_graphs
pgleeson Mar 21, 2024
afec2ee
Merge branch 'cyclic_graphs' of github.com:ModECI/MDF into cyclic_graphs
pgleeson May 23, 2024
12dcdcf
Merge branch 'development' into cyclic_graphs
pgleeson May 23, 2024
6798a44
Regenerated
pgleeson May 23, 2024
9f39d5b
Regenerated nml
pgleeson May 28, 2024
d936d5e
Consolidate network example
pgleeson May 28, 2024
fb17b0f
Merge branch 'nml_examples' into cyclic_graphs
pgleeson May 28, 2024
4fd279a
Regenerated images
pgleeson May 29, 2024
c63e666
Merge pull request #544 from ModECI/development
pgleeson Feb 5, 2025
d4a12b9
Merge branch 'development' into cyclic_graphs
pgleeson Mar 28, 2025
cda5a09
Merge branch 'development' into cyclic_graphs
pgleeson Mar 28, 2025
1e851d6
Regenerated
pgleeson Mar 28, 2025
6201123
Merge pull request #548 from ModECI/cyclic_graphs
pgleeson May 7, 2025
26eda86
Merge branch 'development' into nml_examples
pgleeson Jun 18, 2025
106519b
Merge branch 'development' into nml_examples
pgleeson Jun 23, 2025
9849cb0
Regenerated images
pgleeson Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ Thumbs.db #thumbnail cache on Windows
/examples/PyTorch/simple_pytorch_to_mdf.1
/examples/MDF/NLP/TestNLP_3
/examples/MDF/NLP/TestNLP
/examples/MDF/networks/Net_acyclical
/examples/MDF/net/Net_acyclical
/examples/MDF/net/weight.py
/examples/MDF/conditions/composite_example
/examples/NeuroML/arm64
/examples/MDF/RNN/iaf.net
Expand Down
8 changes: 8 additions & 0 deletions docs/MDF_specification.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,21 @@
"type": "str",
"description": "The unique (for this Node) id of the input port,"
},
"default_value": {
"type": "Union[EvaluableExpression, List, Dict, ndarray, int, float, str, NoneType]",
"description": "Value to set at this input port if no edge connected to it."
},
"shape": {
"type": "Union[Tuple[int, ...], NoneType]",
"description": "The shape of the input port. This uses the same syntax as numpy ndarray shapes\n(e.g., :code:`numpy.zeros(shape)` would produce an array with the correct shape"
},
"type": {
"type": "Union[str, NoneType]",
"description": "The data type of the input received at a port."
},
"reduce": {
"type": "Union[str, NoneType]",
"description": "Specifies how to deal with multiple inputs to one port during a single timestep: add: add up all the values; multiply: multiply the values, overwrite: just use the last value supplied (default)"
}
}
},
Expand Down
11 changes: 11 additions & 0 deletions docs/MDF_specification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ specification:
id:
type: str
description: The unique (for this Node) id of the input port,
default_value:
type: Union[EvaluableExpression, List, Dict, ndarray, int, float,
str, NoneType]
description: Value to set at this input port if no edge connected
to it.
shape:
type: Union[Tuple[int, ...], NoneType]
description: 'The shape of the input port. This uses the same syntax
Expand All @@ -101,6 +106,12 @@ specification:
type:
type: Union[str, NoneType]
description: The data type of the input received at a port.
reduce:
type: Union[str, NoneType]
description: 'Specifies how to deal with multiple inputs to one port
during a single timestep: add: add up all the values; multiply:
multiply the values, overwrite: just use the last value supplied
(default)'
Function:
definition: A single value which is evaluated as a function of values on :class:`InputPort`(s)
and other Functions
Expand Down
14 changes: 14 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ The <a href="#inputport">InputPort</a> is an attribute of a Node which allows ex
</tr>


<tr>
<td><b>default_value</b></td>
<td>Union[EvaluableExpression, List, Dict, ndarray, int, float, str, NoneType]</td>
<td><i>Value to set at this input port if no edge connected to it.</i></td>
</tr>


<tr>
<td><b>shape</b></td>
<td>Union[Tuple[int, ...], NoneType]</td>
Expand All @@ -194,6 +201,13 @@ The <a href="#inputport">InputPort</a> is an attribute of a Node which allows ex
</tr>


<tr>
<td><b>reduce</b></td>
<td>Union[str, NoneType]</td>
<td><i>Specifies how to deal with multiple inputs to one port during a single timestep: add: add up all the values; multiply: multiply the values, overwrite: just use the last value supplied (default)</i></td>
</tr>


</table>

## Function
Expand Down
20 changes: 11 additions & 9 deletions docs/sphinx/source/api/Specification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ The `InputPort <#inputport>`__ is an attribute of a Node which allows external i

**Allowed parameters**

=============== ================================ =============================================================================================
Allowed field Data Type Description
=============== ================================ =============================================================================================
**metadata** Union[Any, NoneType] Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
**id** str The unique (for this Node) id of the input port,
**shape** Union[Tuple[int, ...], NoneType] The shape of the input port. This uses the same syntax as numpy ndarray shapes
(e.g., **numpy.zeros(shape)** would produce an array with the correct shape
**type** Union[str, NoneType] The data type of the input received at a port.
=============== ================================ =============================================================================================
================= ========================================================================== =================================================================================================================================================================================================
Allowed field Data Type Description
================= ========================================================================== =================================================================================================================================================================================================
**metadata** Union[Any, NoneType] Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
**id** str The unique (for this Node) id of the input port,
**default_value** Union[EvaluableExpression, List, Dict, ndarray, int, float, str, NoneType] Value to set at this input port if no edge connected to it.
**shape** Union[Tuple[int, ...], NoneType] The shape of the input port. This uses the same syntax as numpy ndarray shapes
(e.g., **numpy.zeros(shape)** would produce an array with the correct shape
**type** Union[str, NoneType] The data type of the input received at a port.
**reduce** Union[str, NoneType] Specifies how to deal with multiple inputs to one port during a single timestep: add: add up all the values; multiply: multiply the values, overwrite: just use the last value supplied (default)
================= ========================================================================== =================================================================================================================================================================================================

========
Function
Expand Down
Binary file modified docs/sphinx/source/api/export_format/NeuroML/Izh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/sphinx/source/api/export_format/ONNX/abc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions examples/MDF/RNN/IAF_net.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"current_input": {
"shape": [
8
]
],
"reduce": "add"
}
},
"parameters": {
Expand Down Expand Up @@ -140,7 +141,8 @@
"current_input": {
"shape": [
8
]
],
"reduce": "add"
}
},
"parameters": {
Expand Down Expand Up @@ -224,7 +226,8 @@
"spike_input": {
"shape": [
8
]
],
"reduce": "add"
}
},
"parameters": {
Expand Down
3 changes: 3 additions & 0 deletions examples/MDF/RNN/IAF_net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ IAF_net:
current_input:
shape:
- 8
reduce: add
parameters:
v0:
value:
Expand Down Expand Up @@ -99,6 +100,7 @@ IAF_net:
current_input:
shape:
- 8
reduce: add
parameters:
v0:
value:
Expand Down Expand Up @@ -158,6 +160,7 @@ IAF_net:
spike_input:
shape:
- 8
reduce: add
parameters:
syn_tau:
value: 10
Expand Down
9 changes: 6 additions & 3 deletions examples/MDF/RNN/IAF_net2.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"current_input": {
"shape": [
8
]
],
"reduce": "add"
}
},
"parameters": {
Expand Down Expand Up @@ -149,7 +150,8 @@
"current_input": {
"shape": [
8
]
],
"reduce": "add"
}
},
"parameters": {
Expand Down Expand Up @@ -233,7 +235,8 @@
"spike_input": {
"shape": [
8
]
],
"reduce": "add"
}
},
"parameters": {
Expand Down
3 changes: 3 additions & 0 deletions examples/MDF/RNN/IAF_net2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ IAF_net2:
current_input:
shape:
- 8
reduce: add
parameters:
v0:
value:
Expand Down Expand Up @@ -107,6 +108,7 @@ IAF_net2:
current_input:
shape:
- 8
reduce: add
parameters:
v0:
value:
Expand Down Expand Up @@ -166,6 +168,7 @@ IAF_net2:
spike_input:
shape:
- 8
reduce: add
parameters:
syn_tau:
value: 10
Expand Down
Loading