Skip to content

Commit abda25b

Browse files
authored
Merge pull request #529 from ModECI/nml_examples
Updated to v0.4.10; regenerated documentation/example files
2 parents 9af8aa7 + c3c4ad3 commit abda25b

90 files changed

Lines changed: 227754 additions & 227660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,3 +310,4 @@ examples/TensorFlow/Keras/keras_to_MDF
310310
/checkout_pngs.sh
311311
/examples/TensorFlow/Keras/IRIS/keras_model_on_iris.keras
312312
/examples/TensorFlow/Keras/MNIST/kr_N_model.keras
313+
/checkoutpngs.sh

docs/MDF_function_specifications.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,30 @@
1414
],
1515
"expression_string": "A * (A > 0)"
1616
},
17+
"arccos": {
18+
"description": "Inverse cosine function",
19+
"arguments": [
20+
"variable0",
21+
"scale"
22+
],
23+
"expression_string": "scale * arccos(variable0)"
24+
},
25+
"arcsin": {
26+
"description": "Inverse sine function",
27+
"arguments": [
28+
"variable0",
29+
"scale"
30+
],
31+
"expression_string": "scale * arcsin(variable0)"
32+
},
33+
"arctan": {
34+
"description": "Inverse tangent function",
35+
"arguments": [
36+
"variable0",
37+
"scale"
38+
],
39+
"expression_string": "scale * arctan(variable0)"
40+
},
1741
"change_goal": {
1842
"description": "Modifies the current goal buffer using the given pattern.",
1943
"arguments": [
@@ -687,7 +711,7 @@
687711
"expression_string": "onnx_ops.max(data_0)"
688712
},
689713
"onnx::MaxPool": {
690-
"description": "\n MaxPool consumes an input tensor X and applies max pooling across\n the tensor according to kernel sizes, stride sizes, and pad lengths.\n max pooling consisting of computing the max on all values of a\n subset of the input tensor according to the kernel size and downsampling the\n data into the output tensor Y for further processing. The output spatial shape is calculated differently\n depending on whether explicit padding is used, where pads is employed, or auto padding is used, where auto_pad is utilized.\n With explicit padding (https://pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html?highlight=maxpool#torch.nn.MaxPool2d):\n ```\n output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)\n ```\n or\n ```\n output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)\n ```\n if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`.\n\n `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled:\n ```\n VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])\n SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])\n ```\n or when ceil_mode is disabled (https://www.tensorflow.org/api_docs/python/tf/keras/layers/AveragePooling2D):\n ```\n VALID: output_spatial_shape[i] = floor((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1)) / strides_spatial_shape[i]) + 1\n SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = floor((input_spatial_shape[i] - 1) / strides_spatial_shape[i]) + 1\n ```\n And pad shape will be following if `SAME_UPPER` or `SAME_LOWER`:\n ```\n pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i]\n ```\n The output of each pooling window is maximum number of elements exclude pad. \n ",
714+
"description": "\n MaxPool consumes an input tensor X and applies max pooling across\n the tensor according to kernel sizes, stride sizes, and pad lengths.\n max pooling consisting of computing the max on all values of a\n subset of the input tensor according to the kernel size and downsampling the\n data into the output tensor Y for further processing. The output spatial shape is calculated differently\n depending on whether explicit padding is used, where pads is employed, or auto padding is used, where auto_pad is utilized.\n With explicit padding (https://pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html?highlight=maxpool#torch.nn.MaxPool2d):\n ```\n output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)\n ```\n or\n ```\n output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)\n ```\n if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored.\n\n `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled:\n ```\n VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])\n SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])\n ```\n or when ceil_mode is disabled (https://www.tensorflow.org/api_docs/python/tf/keras/layers/AveragePooling2D):\n ```\n VALID: output_spatial_shape[i] = floor((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1)) / strides_spatial_shape[i]) + 1\n SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = floor((input_spatial_shape[i] - 1) / strides_spatial_shape[i]) + 1\n ```\n And pad shape will be following if `SAME_UPPER` or `SAME_LOWER`:\n ```\n pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i]\n ```\n The output of each pooling window is maximum number of elements exclude pad. \n ",
691715
"arguments": [
692716
"X"
693717
],
@@ -1335,7 +1359,7 @@
13351359
"expression_string": "onnx_ops.tile(input, repeats)"
13361360
},
13371361
"onnx::TopK": {
1338-
"description": "\nRetrieve the top-K largest or smallest elements along a specified axis. Given an input tensor of\nshape [a_1, a_2, ..., a_n, r] and integer argument k, return two outputs:\n\n* Value tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n]\n which contains the values of the top k elements along the specified axis\n* Index tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n] which\n contains the indices of the top k elements (original indices from the input\n tensor).\n\n* If \"largest\" is 1 (the default value) then the k largest elements are returned.\n* If \"sorted\" is 1 (the default value) then the resulting k elements will be sorted.\n* If \"sorted\" is 0, order of returned 'Values' and 'Indices' are undefined.\n\nGiven two equivalent values, this operator uses the indices along the axis as\na tiebreaker. That is, the element with the lower index will appear first.\n",
1362+
"description": "\nRetrieve the top-K largest or smallest elements along a specified axis. Given an input tensor of\nshape [a_0, a_1, ..., a_{n-1}] and integer argument k, return two outputs:\n\n* Value tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}]\n which contains the values of the top k elements along the specified axis\n* Index tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] which\n contains the indices of the top k elements (original indices from the input\n tensor).\n\n* If \"largest\" is 1 (the default value) then the k largest elements are returned.\n* If \"sorted\" is 1 (the default value) then the resulting k elements will be sorted.\n* If \"sorted\" is 0, order of returned 'Values' and 'Indices' are undefined.\n\nGiven two equivalent values, this operator uses the indices along the axis as\na tiebreaker. That is, the element with the lower index will appear first.\n",
13391363
"arguments": [
13401364
"X",
13411365
"K"

docs/MDF_function_specifications.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ These functions are defined in Python API module <a href="https://github.com/Mod
55

66
- <a href="#matmul">MatMul</a>
77
- <a href="#relu">Relu</a>
8+
- <a href="#arccos">arccos</a>
9+
- <a href="#arcsin">arcsin</a>
10+
- <a href="#arctan">arctan</a>
811
- <a href="#changegoal">change_goal</a>
912
- <a href="#checktermination">check_termination</a>
1013
- <a href="#chunktostring">chunk_to_string</a>
@@ -211,6 +214,30 @@ Python version: `A @ B`
211214

212215
Python version: `A * (A > 0)`
213216

217+
<a name="arccos"></a>
218+
219+
## arccos
220+
<p><i>Inverse cosine function</i></p>
221+
<p><b>arccos(variable0, scale)</b> = scale * arccos(variable0)</p>
222+
223+
Python version: `scale * numpy.arccos(variable0)`
224+
225+
<a name="arcsin"></a>
226+
227+
## arcsin
228+
<p><i>Inverse sine function</i></p>
229+
<p><b>arcsin(variable0, scale)</b> = scale * arcsin(variable0)</p>
230+
231+
Python version: `scale * numpy.arcsin(variable0)`
232+
233+
<a name="arctan"></a>
234+
235+
## arctan
236+
<p><i>Inverse tangent function</i></p>
237+
<p><b>arctan(variable0, scale)</b> = scale * arctan(variable0)</p>
238+
239+
Python version: `scale * numpy.arctan(variable0)`
240+
214241
<a name="changegoal"></a>
215242

216243
## change_goal
@@ -320,7 +347,7 @@ Python version: `onnx_ops.abs(X)`
320347
Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise.
321348
</i></p>
322349

323-
Python version: `onnx_ops.anumpy.cos(input)`
350+
Python version: `onnx_ops.acos(input)`
324351

325352
<a href=https://onnx.ai/onnx/operators/onnx__Acos.html><i>ONNX Documentation</i></a>
326353
<a name="acosh"></a>
@@ -330,7 +357,7 @@ Python version: `onnx_ops.anumpy.cos(input)`
330357
Calculates the hyperbolic arccosine of the given input tensor element-wise.
331358
</i></p>
332359

333-
Python version: `onnx_ops.anumpy.cosh(input)`
360+
Python version: `onnx_ops.acosh(input)`
334361

335362
<a href=https://onnx.ai/onnx/operators/onnx__Acosh.html><i>ONNX Documentation</i></a>
336363
<a name="add"></a>
@@ -397,7 +424,7 @@ Python version: `onnx_ops.argmin(data, axis, keepdims, select_last_index)`
397424
Calculates the arcsine (inverse of sine) of the given input tensor, element-wise.
398425
</i></p>
399426

400-
Python version: `onnx_ops.anumpy.sin(input)`
427+
Python version: `onnx_ops.asin(input)`
401428

402429
<a href=https://onnx.ai/onnx/operators/onnx__Asin.html><i>ONNX Documentation</i></a>
403430
<a name="asinh"></a>
@@ -407,7 +434,7 @@ Python version: `onnx_ops.anumpy.sin(input)`
407434
Calculates the hyperbolic arcsine of the given input tensor element-wise.
408435
</i></p>
409436

410-
Python version: `onnx_ops.anumpy.sinh(input)`
437+
Python version: `onnx_ops.asinh(input)`
411438

412439
<a href=https://onnx.ai/onnx/operators/onnx__Asinh.html><i>ONNX Documentation</i></a>
413440
<a name="atan"></a>
@@ -417,7 +444,7 @@ Python version: `onnx_ops.anumpy.sinh(input)`
417444
Calculates the arctangent (inverse of tangent) of the given input tensor, element-wise.
418445
</i></p>
419446

420-
Python version: `onnx_ops.anumpy.tan(input)`
447+
Python version: `onnx_ops.atan(input)`
421448

422449
<a href=https://onnx.ai/onnx/operators/onnx__Atan.html><i>ONNX Documentation</i></a>
423450
<a name="atanh"></a>
@@ -427,7 +454,7 @@ Python version: `onnx_ops.anumpy.tan(input)`
427454
Calculates the hyperbolic arctangent of the given input tensor element-wise.
428455
</i></p>
429456

430-
Python version: `onnx_ops.anumpy.tanh(input)`
457+
Python version: `onnx_ops.atanh(input)`
431458

432459
<a href=https://onnx.ai/onnx/operators/onnx__Atanh.html><i>ONNX Documentation</i></a>
433460
<a name="averagepool"></a>
@@ -1705,7 +1732,7 @@ Python version: `onnx_ops.max(data_0)`
17051732
```
17061733
output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1)
17071734
```
1708-
if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`.
1735+
if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored.
17091736

17101737
`auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled:
17111738
```
@@ -2464,7 +2491,7 @@ valid. Reduction over an empty set of values yields minus infinity (if supported
24642491
The above behavior is similar to numpy, with the exception that numpy defaults `keepdims`
24652492
to `False` instead of `True`.</i></p>
24662493

2467-
Python version: `onnx_ops.reducelogsumnumpy.exp(data, axes, keepdims)`
2494+
Python version: `onnx_ops.reducelogsumexp(data, axes, keepdims)`
24682495

24692496
<a href=https://onnx.ai/onnx/operators/onnx__ReduceLogSumExp.html><i>ONNX Documentation</i></a>
24702497
<a name="reducemax"></a>
@@ -3431,11 +3458,11 @@ Python version: `onnx_ops.tile(input, repeats)`
34313458
## TopK
34323459
<p><i>
34333460
Retrieve the top-K largest or smallest elements along a specified axis. Given an input tensor of
3434-
shape [a_1, a_2, ..., a_n, r] and integer argument k, return two outputs:
3461+
shape [a_0, a_1, ..., a_{n-1}] and integer argument k, return two outputs:
34353462

3436-
* Value tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n]
3463+
* Value tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}]
34373464
which contains the values of the top k elements along the specified axis
3438-
* Index tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n] which
3465+
* Index tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] which
34393466
contains the indices of the top k elements (original indices from the input
34403467
tensor).
34413468

docs/MDF_function_specifications.yaml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ Relu:
99
arguments:
1010
- A
1111
expression_string: A * (A > 0)
12+
arccos:
13+
description: Inverse cosine function
14+
arguments:
15+
- variable0
16+
- scale
17+
expression_string: scale * arccos(variable0)
18+
arcsin:
19+
description: Inverse sine function
20+
arguments:
21+
- variable0
22+
- scale
23+
expression_string: scale * arcsin(variable0)
24+
arctan:
25+
description: Inverse tangent function
26+
arguments:
27+
- variable0
28+
- scale
29+
expression_string: scale * arctan(variable0)
1230
change_goal:
1331
description: Modifies the current goal buffer using the given pattern.
1432
arguments:
@@ -1650,7 +1668,8 @@ onnx::MaxPool:
16501668
\ 1)\n ```\n or\n ```\n output_spatial_shape[i] = ceil((input_spatial_shape[i]\
16511669
\ + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i]\
16521670
\ + 1)\n ```\n if ceil_mode is enabled. `pad_shape[i]` is the sum of pads\
1653-
\ along axis `i`.\n\n `auto_pad` is a DEPRECATED attribute. If you are using\
1671+
\ along axis `i`. Sliding windows that would start in the right padded region\
1672+
\ are ignored.\n\n `auto_pad` is a DEPRECATED attribute. If you are using\
16541673
\ them currently, the output spatial shape will be following when ceil_mode\
16551674
\ is enabled:\n ```\n VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i]\
16561675
\ - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i])\n\
@@ -3461,18 +3480,18 @@ onnx::Tile:
34613480
expression_string: onnx_ops.tile(input, repeats)
34623481
onnx::TopK:
34633482
description: "\nRetrieve the top-K largest or smallest elements along a specified\
3464-
\ axis. Given an input tensor of\nshape [a_1, a_2, ..., a_n, r] and integer\
3465-
\ argument k, return two outputs:\n\n* Value tensor of shape [a_1, a_2, ...,\
3466-
\ a_{axis-1}, k, a_{axis+1}, ... a_n]\n which contains the values of the\
3467-
\ top k elements along the specified axis\n* Index tensor of shape [a_1, a_2,\
3468-
\ ..., a_{axis-1}, k, a_{axis+1}, ... a_n] which\n contains the indices of\
3469-
\ the top k elements (original indices from the input\n tensor).\n\n* If\
3470-
\ \"largest\" is 1 (the default value) then the k largest elements are returned.\n\
3471-
* If \"sorted\" is 1 (the default value) then the resulting k elements will\
3472-
\ be sorted.\n* If \"sorted\" is 0, order of returned 'Values' and 'Indices'\
3473-
\ are undefined.\n\nGiven two equivalent values, this operator uses the indices\
3474-
\ along the axis as\na tiebreaker. That is, the element with the lower index\
3475-
\ will appear first.\n"
3483+
\ axis. Given an input tensor of\nshape [a_0, a_1, ..., a_{n-1}] and integer\
3484+
\ argument k, return two outputs:\n\n* Value tensor of shape [a_0, a_1, ...,\
3485+
\ a_{axis-1}, k, a_{axis+1}, ... a_{n-1}]\n which contains the values of\
3486+
\ the top k elements along the specified axis\n* Index tensor of shape [a_0,\
3487+
\ a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] which\n contains the\
3488+
\ indices of the top k elements (original indices from the input\n tensor).\n\
3489+
\n* If \"largest\" is 1 (the default value) then the k largest elements are\
3490+
\ returned.\n* If \"sorted\" is 1 (the default value) then the resulting k\
3491+
\ elements will be sorted.\n* If \"sorted\" is 0, order of returned 'Values'\
3492+
\ and 'Indices' are undefined.\n\nGiven two equivalent values, this operator\
3493+
\ uses the indices along the axis as\na tiebreaker. That is, the element with\
3494+
\ the lower index will appear first.\n"
34763495
arguments:
34773496
- X
34783497
- K

docs/MDF_specification.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
},
167167
"function": {
168168
"type": "Union[str, NoneType]",
169-
"description": "Which of the in-build MDF functions (linear etc.) this uses, See"
169+
"description": "Which of the in-build MDF functions (linear etc.) this uses, See\nhttps://mdf.readthedocs.io/en/latest/api/MDF_function_specifications.html"
170170
},
171171
"args": {
172172
"type": "Union[Any, NoneType]",

docs/MDF_specification.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,10 @@ specification:
168168
of time are seconds.
169169
function:
170170
type: Union[str, NoneType]
171-
description: Which of the in-build MDF functions (linear etc.) this
171+
description: 'Which of the in-build MDF functions (linear etc.) this
172172
uses, See
173+
174+
https://mdf.readthedocs.io/en/latest/api/MDF_function_specifications.html'
173175
args:
174176
type: Union[Any, NoneType]
175177
description: 'Dictionary of values for each of the arguments for the

docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ inbuilt <b>function</b> with <b>args</b>; 4) or change from a <b>default_initial
286286
<tr>
287287
<td><b>function</b></td>
288288
<td>Union[str, NoneType]</td>
289-
<td><i>Which of the in-build MDF functions (linear etc.) this uses, See</i></td>
289+
<td><i>Which of the in-build MDF functions (linear etc.) this uses, See
290+
https://mdf.readthedocs.io/en/latest/api/MDF<a href="#function">function</a>specifications.html</i></td>
290291
</tr>
291292

292293

0 commit comments

Comments
 (0)