Browse Source

merge with master.

tags/v0.12
Oceania2018 6 years ago
parent
commit
164759174d
21 changed files with 639 additions and 200 deletions
  1. +7
    -6
      README.md
  2. BIN
      docs/assets/tf.net.logo.png
  3. +138
    -155
      docs/assets/tf.net.logo.svg
  4. +19
    -0
      src/TensorFlowNET.Core/APIs/tf.control.cs
  5. +5
    -2
      src/TensorFlowNET.Core/APIs/tf.math.cs
  6. +0
    -5
      src/TensorFlowNET.Core/Framework/Models/ScopedTFGraph.cs
  7. +1
    -1
      src/TensorFlowNET.Core/Graphs/Graph.Control.cs
  8. +0
    -1
      src/TensorFlowNET.Core/Graphs/Graph.cs
  9. +36
    -0
      src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs
  10. +165
    -12
      src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs
  11. +34
    -7
      src/TensorFlowNET.Core/Operations/NnOps/rnn.cs
  12. +91
    -3
      src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs
  13. +87
    -0
      src/TensorFlowNET.Core/Operations/gen_control_flow_ops.py.cs
  14. +8
    -0
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs
  15. +3
    -0
      src/TensorFlowNET.Core/Operations/math_ops.cs
  16. +6
    -5
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj
  17. +1
    -1
      src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs
  18. +6
    -0
      src/TensorFlowNET.Core/Tensors/Tensor.cs
  19. +10
    -1
      src/TensorFlowNET.Core/Tensors/TensorShape.cs
  20. +9
    -0
      test/TensorFlowNET.UnitTest/OperationsTest.cs
  21. +13
    -1
      test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs

+ 7
- 6
README.md View File

@@ -1,7 +1,6 @@
# TensorFlow.NET
![logo](docs/assets/tf.net.logo.svg)
![logo](docs/assets/tf.net.logo.png)

TensorFlow.NET (TF.NET) provides a .NET Standard binding for [TensorFlow](https://www.tensorflow.org/). It aims to implement the complete Tensorflow API in CSharp which allows .NET developers to develop, train and deploy Machine Learning models with the cross-platform .NET Standard framework.
**TensorFlow.NET** (TF.NET) provides a .NET Standard binding for [TensorFlow](https://www.tensorflow.org/). It aims to implement the complete Tensorflow API in CSharp which allows .NET developers to develop, train and deploy Machine Learning models with the cross-platform .NET Standard framework.

[![Join the chat at https://gitter.im/publiclab/publiclab](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sci-sharp/community)
[![Tensorflow.NET](https://ci.appveyor.com/api/projects/status/wx4td43v2d3f2xj6?svg=true)](https://ci.appveyor.com/project/Haiping-Chen/tensorflow-net)
@@ -10,7 +9,8 @@ TensorFlow.NET (TF.NET) provides a .NET Standard binding for [TensorFlow](https:
[![Documentation Status](https://readthedocs.org/projects/tensorflownet/badge/?version=latest)](https://tensorflownet.readthedocs.io/en/latest/?badge=latest)
[![Badge](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu/#/en_US)

TF.NET is a member project of [SciSharp STACK](https://github.com/SciSharp).
TF.NET is a member project of [SciSharp STACK](https://github.com/SciSharp). <a href="http://scisharpstack.org"><img src="https://github.com/SciSharp/SciSharp/blob/master/art/scisharp_badge.png" width="200" height="200" align="right" /></a>


![tensors_flowing](docs/assets/tensors_flowing.gif)

@@ -200,5 +200,6 @@ Scan QR code to join Tencent TIM group:

![SciSharp STACK](docs/TIM.jpg)

![SciSharp](https://avatars3.githubusercontent.com/u/44989469) TensorFlow.NET is a part of [SciSharp STACK](https://scisharp.github.io/SciSharp/)

TensorFlow.NET is a part of [SciSharp STACK](https://scisharp.github.io/SciSharp/)
<br>
<a href="http://scisharpstack.org"><img src="https://github.com/SciSharp/SciSharp/blob/master/art/scisharp-stack.png" width="391" height="100" /></a>

BIN
docs/assets/tf.net.logo.png View File

Before After
Width: 350  |  Height: 95  |  Size: 8.8 kB Width: 960  |  Height: 241  |  Size: 27 kB

+ 138
- 155
docs/assets/tf.net.logo.svg View File

@@ -9,15 +9,15 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="355.00195"
height="95.964485"
viewBox="0 0 93.9276 25.390603"
width="383.01572"
height="95.964455"
viewBox="0 0 101.33957 25.390595"
version="1.1"
id="svg8"
sodipodi:docname="tf.net.logo.svg"
inkscape:export-filename="tf.net.logo512.png"
inkscape:export-xdpi="138.45558"
inkscape:export-ydpi="138.45558"
inkscape:export-filename="tf.net.logo.png"
inkscape:export-xdpi="240.61676"
inkscape:export-ydpi="240.61676"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<defs
id="defs2" />
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="156.72376"
inkscape:cy="62.579314"
inkscape:zoom="1.979899"
inkscape:cx="192.14333"
inkscape:cy="12.853681"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
@@ -40,7 +40,7 @@
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
@@ -63,165 +63,148 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-15.426685,-284.39917)">
transform="translate(-14.85972,-284.39917)">
<rect
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.18312271;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1330-0-7"
width="101.33958"
height="25.390594"
x="14.85972"
y="284.39917"
inkscape:export-filename=".\g6243-6.png"
inkscape:export-xdpi="368"
inkscape:export-ydpi="368" />
<g
id="g929">
<rect
inkscape:export-ydpi="368"
inkscape:export-xdpi="368"
inkscape:export-filename=".\g6243-6.png"
y="284.39917"
x="15.426685"
height="25.390604"
width="93.927597"
id="rect1330-0-7"
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.18312271;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
transform="matrix(1.5952381,0,0,1.5952381,17.392161,-166.33938)"
id="g836">
<g
aria-label="TensorFlow.NET"
style="font-style:normal;font-weight:normal;font-size:10.16481495px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25412035"
id="text6563-9-6-3">
transform="matrix(0.17545692,0,0,0.17545692,7.4983819,273.23227)"
id="g1731-8">
<path
d="m 44.621882,294.39477 q 0,0.0943 -0.0099,0.16379 -0.0099,0.0695 -0.03474,0.11415 -0.01985,0.0397 -0.0546,0.0596 -0.02978,0.0199 -0.06949,0.0199 h -1.806637 v 5.56881 q 0,0.0397 -0.01985,0.0695 -0.01985,0.0298 -0.06949,0.0496 -0.04963,0.0149 -0.134009,0.0248 -0.07941,0.0149 -0.203495,0.0149 -0.119118,0 -0.203494,-0.0149 -0.08438,-0.01 -0.134009,-0.0248 -0.04963,-0.0199 -0.06949,-0.0496 -0.01985,-0.0298 -0.01985,-0.0695 v -5.56881 h -1.806637 q -0.03971,0 -0.07445,-0.0199 -0.02978,-0.0199 -0.04963,-0.0596 -0.01985,-0.0447 -0.03474,-0.11415 -0.0099,-0.0695 -0.0099,-0.16379 0,-0.0943 0.0099,-0.16379 0.01489,-0.0745 0.03474,-0.11912 0.01985,-0.0447 0.04963,-0.0645 0.03474,-0.0199 0.07445,-0.0199 h 4.466959 q 0.03971,0 0.06949,0.0199 0.03474,0.0198 0.0546,0.0645 0.02482,0.0447 0.03474,0.11912 0.0099,0.0695 0.0099,0.16379 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1910"
sodipodi:nodetypes="ccccccccccccccccc"
style="fill:#661f76;fill-opacity:1;stroke:#ffffff;stroke-width:0.75398374;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m -36.084117,86.919493 -0.0167,10.510987 9.259924,5.44165 6.987324,-4.039809 -0.01769,26.833699 9.22461,5.45093 9.2346449,-5.33607 0.017447,-9.42605 8.277363,-4.77736 2.248e-4,-10.46314 -8.0993129,-4.738868 -0.1010935,-7.187906 15.2741647,8.908856 9.189919,-5.389023 0.02008,-10.556164 L -2.2396399,67.44954 Z"
id="path1689-5"
inkscape:connector-curvature="0" />
<path
d="m 48.384055,297.89885 q 0,0.19357 -0.09927,0.27795 -0.0943,0.0794 -0.218385,0.0794 h -2.92834 q 0,0.37224 0.07445,0.67004 0.07445,0.2978 0.248164,0.51122 0.173715,0.21342 0.451659,0.32758 0.277944,0.11415 0.679971,0.11415 0.31765,0 0.565815,-0.0496 0.248164,-0.0546 0.426843,-0.11912 0.183641,-0.0645 0.297797,-0.11415 0.119119,-0.0546 0.178678,-0.0546 0.03474,0 0.05956,0.0199 0.02978,0.0149 0.04467,0.0496 0.01489,0.0347 0.01985,0.0993 0.0099,0.0596 0.0099,0.1489 0,0.0645 -0.005,0.11416 -0.005,0.0447 -0.01489,0.0844 -0.005,0.0347 -0.02482,0.0645 -0.01489,0.0298 -0.04467,0.0596 -0.02482,0.0248 -0.158825,0.0893 -0.134009,0.0596 -0.347431,0.11912 -0.213421,0.0596 -0.496328,0.10423 -0.277945,0.0496 -0.595595,0.0496 -0.550925,0 -0.967841,-0.15386 -0.411953,-0.15386 -0.694861,-0.45662 -0.282907,-0.30276 -0.426843,-0.75938 -0.143935,-0.45663 -0.143935,-1.06215 0,-0.57574 0.148899,-1.03236 0.148898,-0.46159 0.426843,-0.77924 0.282907,-0.32261 0.67997,-0.49136 0.397063,-0.17372 0.888429,-0.17372 0.526108,0 0.893392,0.16875 0.372246,0.16876 0.610484,0.45663 0.238238,0.2829 0.34743,0.67004 0.114156,0.38217 0.114156,0.81894 z m -0.823906,-0.2432 q 0.01489,-0.64523 -0.287871,-1.01251 -0.297797,-0.36728 -0.888428,-0.36728 -0.302761,0 -0.531072,0.11415 -0.228311,0.11416 -0.382173,0.30276 -0.153862,0.18861 -0.238238,0.44173 -0.08438,0.24817 -0.0943,0.52115 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1912"
inkscape:connector-curvature="0" />
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m -34.982113,87.648437 8.031994,4.677455 v 9.307668 l -8.031994,-4.677459 z"
id="rect1512-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
d="m 53.481352,300.3259 q 0,0.0397 -0.01985,0.0695 -0.01985,0.0248 -0.06452,0.0447 -0.04467,0.0198 -0.124082,0.0298 -0.07941,0.01 -0.198531,0.01 -0.124083,0 -0.203495,-0.01 -0.07941,-0.01 -0.124082,-0.0298 -0.04467,-0.0199 -0.06452,-0.0447 -0.01985,-0.0298 -0.01985,-0.0695 v -2.61565 q 0,-0.38218 -0.05956,-0.61545 -0.05956,-0.23328 -0.173715,-0.40203 -0.114155,-0.16875 -0.297797,-0.25809 -0.178679,-0.0893 -0.416916,-0.0893 -0.307724,0 -0.615448,0.21839 -0.307724,0.21838 -0.645228,0.64026 v 3.12191 q 0,0.0397 -0.01985,0.0695 -0.01985,0.0248 -0.06452,0.0447 -0.04467,0.0198 -0.124082,0.0298 -0.07941,0.01 -0.203495,0.01 -0.119119,0 -0.198531,-0.01 -0.07941,-0.01 -0.129046,-0.0298 -0.04467,-0.0199 -0.06452,-0.0447 -0.01489,-0.0298 -0.01489,-0.0695 v -4.46696 q 0,-0.0397 0.01489,-0.0645 0.01489,-0.0298 0.05956,-0.0496 0.04467,-0.0248 0.114156,-0.0298 0.06949,-0.01 0.183641,-0.01 0.109193,0 0.178679,0.01 0.07445,0.005 0.114155,0.0298 0.03971,0.0199 0.0546,0.0496 0.01985,0.0248 0.01985,0.0645 v 0.59063 q 0.37721,-0.42188 0.749456,-0.61545 0.37721,-0.19853 0.759383,-0.19853 0.446696,0 0.749457,0.15386 0.307724,0.1489 0.496329,0.40203 0.188605,0.25313 0.268017,0.59559 0.08438,0.33751 0.08438,0.81398 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1914"
inkscape:connector-curvature="0" />
sodipodi:nodetypes="ccccccc"
inkscape:connector-curvature="0"
style="opacity:1;vector-effect:none;fill:#3fc6ee;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.39087299;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="M -8.6445312,259.66211 -132.2168,331.26953 -101.85938,348.94922 -8.9550781,295.11328 52.369141,330.64062 82.84305,312.46039 Z"
transform="scale(0.26458333)"
id="rect1512-9-4" />
<path
d="m 57.779561,299.10989 q 0,0.34247 -0.129046,0.61049 -0.124082,0.26802 -0.357357,0.45166 -0.233274,0.18364 -0.555888,0.27794 -0.322614,0.0943 -0.70975,0.0943 -0.238238,0 -0.456623,-0.0397 -0.213421,-0.0347 -0.387136,-0.0893 -0.168752,-0.0596 -0.287871,-0.11912 -0.119119,-0.0645 -0.173715,-0.11416 -0.0546,-0.0496 -0.07941,-0.13897 -0.02482,-0.0893 -0.02482,-0.2432 0,-0.0943 0.0099,-0.15882 0.0099,-0.0645 0.02482,-0.10423 0.01489,-0.0397 0.03971,-0.0546 0.02978,-0.0199 0.06452,-0.0199 0.0546,0 0.158825,0.0695 0.109193,0.0645 0.263054,0.14394 0.158826,0.0794 0.372247,0.1489 0.213422,0.0645 0.491366,0.0645 0.208458,0 0.37721,-0.0447 0.168751,-0.0447 0.292834,-0.12905 0.124082,-0.0893 0.188605,-0.22334 0.06949,-0.13401 0.06949,-0.31765 0,-0.18861 -0.09927,-0.31765 -0.0943,-0.12905 -0.253128,-0.22832 -0.158825,-0.0993 -0.357357,-0.17371 -0.198531,-0.0794 -0.411953,-0.16379 -0.208458,-0.0844 -0.411953,-0.1886 -0.198531,-0.1092 -0.357356,-0.26306 -0.158826,-0.15386 -0.258091,-0.36728 -0.0943,-0.21342 -0.0943,-0.51122 0,-0.26305 0.09927,-0.50129 0.104229,-0.2432 0.307724,-0.42188 0.203495,-0.18364 0.506255,-0.29284 0.307724,-0.10919 0.714714,-0.10919 0.178678,0 0.357357,0.0298 0.178678,0.0298 0.322613,0.0745 0.143936,0.0447 0.243202,0.0993 0.104229,0.0496 0.153861,0.0893 0.0546,0.0397 0.06949,0.0695 0.01985,0.0298 0.02482,0.0695 0.0099,0.0347 0.01489,0.0893 0.0099,0.0546 0.0099,0.13401 0,0.0844 -0.0099,0.14889 -0.005,0.0596 -0.02482,0.0993 -0.01489,0.0397 -0.03971,0.0596 -0.02482,0.0149 -0.0546,0.0149 -0.04467,0 -0.129046,-0.0546 -0.08438,-0.0546 -0.218384,-0.11415 -0.134009,-0.0645 -0.317651,-0.11912 -0.178678,-0.0546 -0.411953,-0.0546 -0.208458,0 -0.367283,0.0496 -0.158825,0.0447 -0.263054,0.134 -0.09927,0.0844 -0.153862,0.2035 -0.04963,0.11912 -0.04963,0.25809 0,0.19357 0.09927,0.32758 0.09926,0.12904 0.258091,0.22831 0.158825,0.0993 0.36232,0.17868 0.203494,0.0794 0.411953,0.16379 0.213421,0.0844 0.416916,0.1886 0.208458,0.10423 0.367283,0.25313 0.158825,0.1489 0.253128,0.35735 0.09927,0.20846 0.09927,0.49633 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1916"
inkscape:connector-curvature="0" />
style="opacity:1;vector-effect:none;fill:#3fc6ee;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m -2.3294599,97.000255 8.031993,4.677455 -8.273187,4.68055 -8.0319941,-4.67746 z"
id="rect1512-9-8-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
d="m 63.100206,298.04279 q 0,0.54596 -0.143936,1.00754 -0.143935,0.45663 -0.431806,0.78917 -0.282907,0.33254 -0.714713,0.52114 -0.426843,0.18364 -0.992658,0.18364 -0.550925,0 -0.962878,-0.16378 -0.40699,-0.16379 -0.67997,-0.47648 -0.272981,-0.31269 -0.40699,-0.75938 -0.134009,-0.4467 -0.134009,-1.01251 0,-0.54597 0.138972,-1.00259 0.143936,-0.46158 0.426843,-0.79412 0.287871,-0.33254 0.714714,-0.51619 0.426842,-0.18364 0.997621,-0.18364 0.550925,0 0.957914,0.16379 0.411953,0.16379 0.684934,0.47648 0.272981,0.31268 0.40699,0.75938 0.138972,0.4467 0.138972,1.00755 z m -0.863612,0.0546 q 0,-0.36232 -0.06949,-0.68493 -0.06452,-0.32261 -0.218385,-0.56582 -0.153862,-0.2432 -0.416916,-0.38217 -0.263055,-0.14393 -0.655154,-0.14393 -0.362321,0 -0.625375,0.12904 -0.258091,0.12905 -0.426843,0.36728 -0.168751,0.23328 -0.253127,0.55589 -0.07941,0.32262 -0.07941,0.70479 0,0.36728 0.06452,0.6899 0.06949,0.32261 0.223348,0.56581 0.158825,0.23824 0.421879,0.38217 0.263055,0.13898 0.655154,0.13898 0.357357,0 0.620411,-0.12905 0.263055,-0.12904 0.431807,-0.36232 0.168751,-0.23327 0.248164,-0.55589 0.07941,-0.32261 0.07941,-0.70975 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1918"
inkscape:connector-curvature="0" />
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.39087299;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m -40.429688,348.70508 -30.357421,17.32031 v 107.0293 l 30.357421,17.67969 v -71.57227 l 30.7128911,18 V 401.98438 L -39.857203,384.30047 Z"
transform="scale(0.26458333)"
id="rect1512-94-56" />
<path
d="m 66.916975,296.15177 q 0,0.1092 -0.005,0.18365 -0.005,0.0744 -0.01985,0.11911 -0.01489,0.0397 -0.03971,0.0645 -0.01985,0.0198 -0.05956,0.0198 -0.03971,0 -0.09926,-0.0198 -0.0546,-0.0248 -0.129046,-0.0447 -0.06949,-0.0248 -0.158825,-0.0447 -0.08934,-0.0199 -0.193568,-0.0199 -0.124083,0 -0.243201,0.0496 -0.119119,0.0496 -0.253128,0.16379 -0.129046,0.11415 -0.272981,0.30276 -0.143935,0.1886 -0.317651,0.46158 v 2.93827 q 0,0.0397 -0.01985,0.0695 -0.01985,0.0248 -0.06452,0.0447 -0.04467,0.0198 -0.124083,0.0298 -0.07941,0.01 -0.203494,0.01 -0.119119,0 -0.198532,-0.01 -0.07941,-0.01 -0.129046,-0.0298 -0.04467,-0.0199 -0.06452,-0.0447 -0.01489,-0.0298 -0.01489,-0.0695 v -4.46696 q 0,-0.0397 0.01489,-0.0645 0.01489,-0.0298 0.05956,-0.0496 0.04467,-0.0248 0.114156,-0.0298 0.06949,-0.01 0.183641,-0.01 0.109193,0 0.178679,0.01 0.07445,0.005 0.114156,0.0298 0.03971,0.0199 0.0546,0.0496 0.01985,0.0248 0.01985,0.0645 v 0.65019 q 0.183642,-0.26802 0.342467,-0.43677 0.163788,-0.16875 0.307724,-0.26305 0.143935,-0.0993 0.282907,-0.13401 0.143935,-0.0397 0.287871,-0.0397 0.06452,0 0.143935,0.01 0.08438,0.005 0.173715,0.0248 0.08934,0.0199 0.158826,0.0447 0.07445,0.0248 0.104229,0.0496 0.02978,0.0248 0.03971,0.0496 0.0099,0.0198 0.01489,0.0546 0.0099,0.0347 0.0099,0.10423 0.005,0.0645 0.005,0.17867 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1920"
inkscape:connector-curvature="0" />
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m -2.3696748,78.082315 16.2254758,9.399559 v 9.30767 L -2.3279139,87.434868 Z"
id="rect1512-94-5-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
d="m 71.329338,294.39477 q 0,0.0943 -0.0099,0.16379 -0.0099,0.0695 -0.03474,0.11415 -0.02482,0.0397 -0.05956,0.0596 -0.02978,0.0199 -0.06452,0.0199 H 68.80802 v 2.18384 h 2.223553 q 0.03474,0 0.06452,0.0199 0.03474,0.0149 0.05956,0.0546 0.02482,0.0397 0.03474,0.1092 0.0099,0.0645 0.0099,0.16875 0,0.0943 -0.0099,0.16379 -0.0099,0.0645 -0.03474,0.10919 -0.02482,0.0397 -0.05956,0.0645 -0.02978,0.0198 -0.06452,0.0198 H 68.80802 v 2.67522 q 0,0.0347 -0.01985,0.0695 -0.01985,0.0298 -0.06949,0.0496 -0.04963,0.0149 -0.129046,0.0248 -0.07941,0.0149 -0.208458,0.0149 -0.119119,0 -0.203495,-0.0149 -0.08438,-0.01 -0.134009,-0.0248 -0.04963,-0.0199 -0.06949,-0.0496 -0.01985,-0.0347 -0.01985,-0.0695 v -5.94602 q 0,-0.19357 0.09927,-0.26802 0.104229,-0.0794 0.218385,-0.0794 h 2.888633 q 0.03474,0 0.06452,0.0199 0.03474,0.0198 0.05956,0.0645 0.02482,0.0447 0.03474,0.11912 0.0099,0.0695 0.0099,0.16379 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1922"
inkscape:connector-curvature="0" />
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 21.909986,82.679259 -8.054185,4.802615 v 9.319569 l 8.031994,-4.677459 z"
id="rect1512-3-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
d="m 73.344431,300.3259 q 0,0.0397 -0.01985,0.0695 -0.01985,0.0248 -0.06452,0.0447 -0.04467,0.0198 -0.124083,0.0298 -0.07941,0.01 -0.203495,0.01 -0.119118,0 -0.198531,-0.01 -0.07941,-0.01 -0.129046,-0.0298 -0.04467,-0.0199 -0.06452,-0.0447 -0.01489,-0.0298 -0.01489,-0.0695 v -6.63095 q 0,-0.0397 0.01489,-0.0695 0.01985,-0.0298 0.06452,-0.0496 0.04963,-0.0199 0.129046,-0.0298 0.07941,-0.01 0.198531,-0.01 0.124083,0 0.203495,0.01 0.07941,0.01 0.124083,0.0298 0.04467,0.0199 0.06452,0.0496 0.01985,0.0298 0.01985,0.0695 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1924"
inkscape:connector-curvature="0" />
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 5.7025331,101.67771 -8.273187,4.68055 v 9.30767 l 8.273187,-4.68056 z"
id="rect1512-3-6-1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
d="m 79.022436,298.04279 q 0,0.54596 -0.143936,1.00754 -0.143935,0.45663 -0.431806,0.78917 -0.282907,0.33254 -0.714713,0.52114 -0.426843,0.18364 -0.992658,0.18364 -0.550925,0 -0.962878,-0.16378 -0.40699,-0.16379 -0.679971,-0.47648 -0.272981,-0.31269 -0.406989,-0.75938 -0.134009,-0.4467 -0.134009,-1.01251 0,-0.54597 0.138972,-1.00259 0.143935,-0.46158 0.426843,-0.79412 0.287871,-0.33254 0.714713,-0.51619 0.426843,-0.18364 0.997621,-0.18364 0.550925,0 0.957915,0.16379 0.411953,0.16379 0.684934,0.47648 0.272981,0.31268 0.406989,0.75938 0.138973,0.4467 0.138973,1.00755 z m -0.863613,0.0546 q 0,-0.36232 -0.06949,-0.68493 -0.06452,-0.32261 -0.218384,-0.56582 -0.153862,-0.2432 -0.416917,-0.38217 -0.263054,-0.14393 -0.655154,-0.14393 -0.36232,0 -0.625374,0.12904 -0.258091,0.12905 -0.426843,0.36728 -0.168752,0.23328 -0.253128,0.55589 -0.07941,0.32262 -0.07941,0.70479 0,0.36728 0.06452,0.6899 0.06949,0.32261 0.223348,0.56581 0.158825,0.23824 0.421879,0.38217 0.263054,0.13898 0.655154,0.13898 0.357357,0 0.620411,-0.12905 0.263055,-0.12904 0.431806,-0.36232 0.168752,-0.23327 0.248165,-0.55589 0.07941,-0.32261 0.07941,-0.70975 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1926"
inkscape:connector-curvature="0" />
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.39087299;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m -8.95767,295.11376 -92.90171,53.83546 v 35.17773 l 61.429692,-35.42383 0.491071,35.51284 31.1339295,-17.60073 V 330.4668 l 0.00586,-0.004 z"
transform="scale(0.26458333)"
id="rect1512-3-65-1" />
<path
d="m 86.437588,295.84901 q 0,0.0347 -0.0099,0.0844 -0.0099,0.0496 -0.03474,0.12408 l -1.315271,4.24361 q -0.01489,0.0546 -0.04963,0.0893 -0.02978,0.0347 -0.08934,0.0546 -0.0546,0.0199 -0.153862,0.0248 -0.09927,0.01 -0.248165,0.01 -0.153862,0 -0.258091,-0.01 -0.104229,-0.01 -0.168752,-0.0298 -0.05956,-0.0199 -0.08934,-0.0546 -0.02978,-0.0347 -0.04467,-0.0844 l -0.938062,-3.24102 -0.0099,-0.0447 -0.0099,0.0447 -0.868576,3.24102 q -0.01489,0.0546 -0.04963,0.0893 -0.02978,0.0347 -0.0943,0.0546 -0.06452,0.0199 -0.168752,0.0248 -0.09927,0.01 -0.248164,0.01 -0.153862,0 -0.253128,-0.01 -0.0943,-0.01 -0.158825,-0.0298 -0.05956,-0.0199 -0.08934,-0.0546 -0.02978,-0.0347 -0.04467,-0.0844 l -1.305345,-4.24361 q -0.02482,-0.0745 -0.03474,-0.12408 -0.0099,-0.0496 -0.0099,-0.0844 0,-0.0447 0.01985,-0.0695 0.01985,-0.0298 0.06452,-0.0447 0.04963,-0.0199 0.129046,-0.0248 0.07941,-0.005 0.193568,-0.005 0.138972,0 0.223348,0.01 0.08438,0.005 0.129046,0.0248 0.04467,0.0149 0.06452,0.0496 0.01985,0.0298 0.03474,0.0745 l 1.077034,3.68276 0.0099,0.0447 0.0099,-0.0447 0.987695,-3.68276 q 0.0099,-0.0447 0.02978,-0.0745 0.02482,-0.0347 0.06949,-0.0496 0.04467,-0.0199 0.119119,-0.0248 0.07941,-0.01 0.203495,-0.01 0.119119,0 0.193568,0.01 0.07941,0.005 0.124083,0.0248 0.04467,0.0149 0.06452,0.0447 0.01985,0.0298 0.02978,0.0695 l 1.067107,3.69268 0.0099,0.0447 0.005,-0.0447 1.062144,-3.68276 q 0.0099,-0.0447 0.02978,-0.0745 0.02482,-0.0347 0.06949,-0.0496 0.04963,-0.0199 0.129045,-0.0248 0.08438,-0.01 0.213421,-0.01 0.119119,0 0.188605,0.005 0.07445,0.005 0.114156,0.0248 0.04467,0.0198 0.05956,0.0447 0.01985,0.0248 0.01985,0.0695 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1928"
inkscape:connector-curvature="0" />
<path
d="m 87.857087,299.90898 q 0,0.3524 -0.119119,0.47152 -0.114155,0.11415 -0.421879,0.11415 -0.297798,0 -0.411953,-0.11415 -0.114156,-0.11416 -0.114156,-0.45663 0,-0.35239 0.114156,-0.46655 0.119119,-0.11911 0.426843,-0.11911 0.297797,0 0.411953,0.11415 0.114155,0.11416 0.114155,0.45662 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1930"
inkscape:connector-curvature="0" />
<path
d="m 94.309363,300.09759 q 0,0.0993 -0.03474,0.16875 -0.02978,0.0695 -0.08438,0.11416 -0.04963,0.0447 -0.114155,0.0645 -0.06452,0.0199 -0.129046,0.0199 h -0.272981 q -0.129045,0 -0.228311,-0.0248 -0.0943,-0.0298 -0.183641,-0.0993 -0.08438,-0.0745 -0.173716,-0.19853 -0.08437,-0.12408 -0.188605,-0.31765 l -2.025021,-3.65298 q -0.158826,-0.28291 -0.322614,-0.59063 -0.158825,-0.31269 -0.297797,-0.60553 h -0.0099 q 0.0099,0.35736 0.01489,0.72961 0.005,0.37224 0.005,0.73953 v 3.87633 q 0,0.0347 -0.01985,0.0695 -0.01985,0.0298 -0.06949,0.0496 -0.04467,0.0149 -0.124082,0.0248 -0.07445,0.0149 -0.193568,0.0149 -0.119119,0 -0.198532,-0.0149 -0.07445,-0.01 -0.119119,-0.0248 -0.04467,-0.0199 -0.06452,-0.0496 -0.01985,-0.0347 -0.01985,-0.0695 v -5.92617 q 0,-0.19853 0.109193,-0.28291 0.109192,-0.0844 0.238237,-0.0844 h 0.40699 q 0.143935,0 0.238238,0.0248 0.09927,0.0248 0.173715,0.0844 0.07941,0.0546 0.148899,0.15882 0.07445,0.0993 0.158825,0.25313 l 1.558473,2.81915 q 0.143935,0.25809 0.277944,0.50625 0.134008,0.24321 0.258091,0.48144 0.124082,0.23824 0.243201,0.47152 0.124082,0.22831 0.243201,0.46158 h 0.005 q -0.0099,-0.3921 -0.01489,-0.81398 0,-0.42684 0,-0.81894 v -3.48423 q 0,-0.0347 0.01985,-0.0645 0.01985,-0.0298 0.06452,-0.0496 0.04963,-0.0248 0.124082,-0.0348 0.07941,-0.01 0.203495,-0.01 0.109193,0 0.188605,0.01 0.07941,0.01 0.124082,0.0348 0.04467,0.0198 0.06452,0.0496 0.01985,0.0298 0.01985,0.0645 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1932"
inkscape:connector-curvature="0" />
<path
d="m 99.600231,300.09759 q 0,0.0893 -0.0099,0.15882 -0.0099,0.0645 -0.03474,0.1092 -0.02482,0.0447 -0.05956,0.0645 -0.02978,0.0198 -0.06949,0.0198 h -3.082202 q -0.114156,0 -0.218385,-0.0744 -0.09927,-0.0794 -0.09927,-0.27298 v -5.72763 q 0,-0.19357 0.09927,-0.26802 0.104229,-0.0794 0.218385,-0.0794 h 3.047459 q 0.03971,0 0.06949,0.0199 0.03474,0.0198 0.0546,0.0645 0.01985,0.0447 0.02978,0.11416 0.01489,0.0645 0.01489,0.16379 0,0.0893 -0.01489,0.15882 -0.0099,0.0645 -0.02978,0.10919 -0.01985,0.0397 -0.0546,0.0596 -0.02978,0.0199 -0.06949,0.0199 h -2.511424 v 2.01509 h 2.154067 q 0.03971,0 0.06949,0.0248 0.03474,0.0199 0.0546,0.0596 0.02482,0.0397 0.03474,0.10919 0.0099,0.0695 0.0099,0.16379 0,0.0893 -0.0099,0.15386 -0.0099,0.0645 -0.03474,0.10423 -0.01985,0.0397 -0.0546,0.0596 -0.02978,0.0149 -0.06949,0.0149 h -2.154067 v 2.298 h 2.546167 q 0.03971,0 0.06949,0.0199 0.03474,0.0199 0.05956,0.0645 0.02482,0.0397 0.03474,0.10919 0.0099,0.0645 0.0099,0.16379 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1934"
inkscape:connector-curvature="0" />
<path
d="m 105.01518,294.39477 q 0,0.0943 -0.01,0.16379 -0.01,0.0695 -0.0347,0.11415 -0.0199,0.0397 -0.0546,0.0596 -0.0298,0.0199 -0.0695,0.0199 h -1.80664 v 5.56881 q 0,0.0397 -0.0198,0.0695 -0.0199,0.0298 -0.0695,0.0496 -0.0496,0.0149 -0.13401,0.0248 -0.0794,0.0149 -0.20349,0.0149 -0.11912,0 -0.2035,-0.0149 -0.0844,-0.01 -0.13401,-0.0248 -0.0496,-0.0199 -0.0695,-0.0496 -0.0199,-0.0298 -0.0199,-0.0695 v -5.56881 h -1.80663 q -0.0397,0 -0.0744,-0.0199 -0.0298,-0.0199 -0.0496,-0.0596 -0.0199,-0.0447 -0.0347,-0.11415 -0.01,-0.0695 -0.01,-0.16379 0,-0.0943 0.01,-0.16379 0.0149,-0.0745 0.0347,-0.11912 0.0199,-0.0447 0.0496,-0.0645 0.0347,-0.0199 0.0744,-0.0199 h 4.46696 q 0.0397,0 0.0695,0.0199 0.0347,0.0198 0.0546,0.0645 0.0248,0.0447 0.0347,0.11912 0.01,0.0695 0.01,0.16379 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#ffffff;stroke-width:0.25412035"
id="path1936"
inkscape:connector-curvature="0" />
</g>
<g
id="g836"
transform="matrix(1.5952381,0,0,1.5952381,17.392161,-166.33938)">
<g
id="g1731-8"
transform="matrix(0.17545692,0,0,0.17545692,7.4983819,273.23227)">
<path
inkscape:connector-curvature="0"
id="path1689-5"
d="m -36.084117,86.919493 -0.0167,10.510987 9.259924,5.44165 6.987324,-4.039809 -0.01769,26.833699 9.22461,5.45093 9.2346449,-5.33607 0.017447,-9.42605 8.277363,-4.77736 2.248e-4,-10.46314 -8.0993129,-4.738868 -0.1010935,-7.187906 15.2741647,8.908856 8.921356,-5.448704 0.13944,-10.466643 L -2.2396399,67.44954 Z"
style="fill:#661f76;fill-opacity:1;stroke:#ffffff;stroke-width:0.75398374;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="ccccccccccccccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect1512-5"
d="m -34.982113,87.648437 8.031994,4.677455 v 9.307668 l -8.031994,-4.677459 z"
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="rect1512-9-4"
transform="scale(0.26458333)"
d="M -8.6445312,259.66211 -132.2168,331.26953 -101.85938,348.94922 -8.9550781,295.11328 52.369141,330.64062 82.84305,312.46039 Z"
style="opacity:1;vector-effect:none;fill:#3fc6ee;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.39087299;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect1512-9-8-8"
d="m -2.3294599,97.000255 8.031993,4.677455 -8.273187,4.68055 -8.0319941,-4.67746 z"
style="opacity:1;vector-effect:none;fill:#3fc6ee;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="rect1512-94-56"
transform="scale(0.26458333)"
d="m -40.429688,348.70508 -30.357421,17.32031 v 107.0293 l 30.357421,17.67969 v -71.57227 l 30.7128911,18 V 401.98438 L -39.857203,384.30047 Z"
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.39087299;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect1512-94-5-5"
d="m -2.3696748,78.082315 16.2254758,9.399559 v 9.30767 L -2.3279139,87.434868 Z"
style="opacity:1;vector-effect:none;fill:#661f76;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect1512-3-7"
d="m 21.909986,82.679259 -8.054185,4.802615 v 9.319569 l 8.031994,-4.677459 z"
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect1512-3-6-1"
d="m 5.7025331,101.67771 -8.273187,4.68055 v 9.30767 l 8.273187,-4.68056 z"
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
id="rect1512-3-65-1"
transform="scale(0.26458333)"
d="m -8.95767,295.11376 -92.90171,53.83546 v 35.17773 l 61.429692,-35.42383 0.491071,35.51284 31.1339295,-17.60073 V 330.4668 l 0.00586,-0.004 z"
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.39087299;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="rect1512-3-6-8-8-9"
d="m -2.5706539,115.66593 -8.1264881,-4.77196 v 18.94606 l 8.1264881,-4.58296 z"
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
style="opacity:1;vector-effect:none;fill:#865fc5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.10341848;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m -2.5706539,115.66593 -8.1264881,-4.77196 v 18.94606 l 8.1264881,-4.58296 z"
id="rect1512-3-6-8-8-9"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</g>
</g>
<g
aria-label="TensorFlow.NET"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:'Roboto Light';-inkscape-font-specification:'Roboto Light, ';letter-spacing:-0.26458332px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
id="text843">
<path
d="m 45.696572,294.03005 h -2.578653 v 6.98149 h -0.635621 v -6.98149 h -2.573486 v -0.5426 h 5.78776 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path831" />
<path
d="m 48.155337,301.11489 q -0.713135,0 -1.291911,-0.3514 -0.573608,-0.3514 -0.894002,-0.97669 -0.320394,-0.63045 -0.320394,-1.41076 v -0.22221 q 0,-0.80615 0.310059,-1.45211 0.315226,-0.64595 0.873331,-1.01286 0.558106,-0.37207 1.209229,-0.37207 1.018026,0 1.612305,0.69763 0.599446,0.69247 0.599446,1.89653 v 0.34623 h -3.98942 v 0.11886 q 0,0.95084 0.542602,1.58646 0.54777,0.63046 1.374593,0.63046 0.496094,0 0.873332,-0.18087 0.382406,-0.18087 0.692464,-0.57878 l 0.387573,0.29456 q -0.682129,0.98702 -1.979207,0.98702 z m -0.113688,-5.271 q -0.697632,0 -1.178223,0.5116 -0.475423,0.5116 -0.578776,1.37459 h 3.353801 v -0.0672 q -0.02584,-0.80615 -0.459921,-1.31258 -0.434082,-0.50643 -1.136881,-0.50643 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path833" />
<path
d="m 51.792324,295.42015 0.02067,0.95601 q 0.315226,-0.51676 0.785481,-0.78548 0.470256,-0.27389 1.038697,-0.27389 0.899169,0 1.338419,0.50643 0.43925,0.50643 0.444417,1.51929 v 3.66903 H 54.80506 v -3.6742 q -0.0052,-0.74931 -0.320394,-1.11621 -0.310059,-0.3669 -0.997355,-0.3669 -0.573608,0 -1.018026,0.36173 -0.439249,0.35657 -0.651123,0.96635 v 3.82923 h -0.614949 v -5.59139 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path835" />
<path
d="m 60.095693,299.59043 q 0,-0.45992 -0.37207,-0.73897 -0.366902,-0.27905 -1.111043,-0.43408 -0.744141,-0.1602 -1.157552,-0.36174 -0.408244,-0.2067 -0.609782,-0.50126 -0.19637,-0.29455 -0.19637,-0.71313 0,-0.66146 0.552937,-1.09038 0.552938,-0.43408 1.415935,-0.43408 0.935343,0 1.498616,0.46509 0.568441,0.45992 0.568441,1.20406 h -0.620117 q 0,-0.49092 -0.413412,-0.81649 -0.408244,-0.32556 -1.033528,-0.32556 -0.609782,0 -0.981853,0.27389 -0.366902,0.26872 -0.366902,0.7028 0,0.41858 0.304891,0.65112 0.310058,0.22738 1.121378,0.41858 0.816488,0.1912 1.219564,0.40824 0.408244,0.21704 0.604614,0.52193 0.196371,0.3049 0.196371,0.73898 0,0.70797 -0.573609,1.13171 -0.56844,0.42375 -1.488281,0.42375 -0.976684,0 -1.586466,-0.47026 -0.604615,-0.47542 -0.604615,-1.19889 h 0.620118 q 0.03617,0.5426 0.454752,0.84749 0.423747,0.29973 1.116211,0.29973 0.645955,0 1.043864,-0.28422 0.397908,-0.28422 0.397908,-0.71831 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path837" />
<path
d="m 61.49509,298.13316 q 0,-0.80615 0.310059,-1.45211 0.315226,-0.64595 0.883667,-1.00252 0.573608,-0.36174 1.297078,-0.36174 1.116211,0 1.808676,0.78548 0.692464,0.78032 0.692464,2.07223 v 0.12919 q 0,0.81132 -0.315227,1.46244 -0.310058,0.64596 -0.878499,0.99736 -0.568441,0.3514 -1.297078,0.3514 -1.111044,0 -1.808675,-0.78032 -0.692465,-0.78548 -0.692465,-2.07739 z m 0.620118,0.17053 q 0,1.00252 0.516764,1.64848 0.521932,0.64079 1.364258,0.64079 0.837158,0 1.353922,-0.64079 0.521932,-0.64596 0.521932,-1.70016 v -0.11885 q 0,-0.64079 -0.237711,-1.17306 -0.237712,-0.53226 -0.666626,-0.82165 -0.428915,-0.29456 -0.981853,-0.29456 -0.826822,0 -1.348754,0.65113 -0.521932,0.64595 -0.521932,1.69498 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path839" />
<path
d="m 70.087848,295.94725 q -0.196371,-0.0362 -0.418579,-0.0362 -0.578776,0 -0.981852,0.32556 -0.397909,0.3204 -0.568441,0.93535 v 3.83956 h -0.61495 v -5.59139 h 0.604615 l 0.01033,0.88883 q 0.490926,-0.99219 1.576131,-0.99219 0.258382,0 0.408244,0.0672 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path841" />
<path
d="m 75.083924,297.49754 h -3.508829 v 3.514 h -0.63562 v -7.52409 h 4.661214 v 0.5426 h -4.025594 v 2.92489 h 3.508829 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path843" />
<path
d="m 77.175786,301.01154 h -0.620117 v -7.9375 h 0.620117 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path845" />
<path
d="m 78.254791,298.13316 q 0,-0.80615 0.310059,-1.45211 0.315226,-0.64595 0.883667,-1.00252 0.573608,-0.36174 1.297078,-0.36174 1.116211,0 1.808675,0.78548 0.692464,0.78032 0.692464,2.07223 v 0.12919 q 0,0.81132 -0.315226,1.46244 -0.310058,0.64596 -0.878499,0.99736 -0.568441,0.3514 -1.297079,0.3514 -1.111043,0 -1.808675,-0.78032 -0.692464,-0.78548 -0.692464,-2.07739 z m 0.620117,0.17053 q 0,1.00252 0.516765,1.64848 0.521932,0.64079 1.364257,0.64079 0.837159,0 1.353923,-0.64079 0.521932,-0.64596 0.521932,-1.70016 v -0.11885 q 0,-0.64079 -0.237712,-1.17306 -0.237711,-0.53226 -0.666626,-0.82165 -0.428914,-0.29456 -0.981852,-0.29456 -0.826823,0 -1.348755,0.65113 -0.521932,0.64595 -0.521932,1.69498 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path847" />
<path
d="m 85.602145,299.72479 0.09302,0.48059 0.124024,-0.50643 1.343587,-4.2788 h 0.5271 l 1.328084,4.24263 0.144694,0.58911 0.118856,-0.5426 1.147216,-4.28914 h 0.640788 l -1.627807,5.59139 h -0.5271 l -1.436605,-4.43384 -0.06718,-0.30489 -0.06718,0.31006 -1.410767,4.42867 h -0.5271 l -1.62264,-5.59139 h 0.635621 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path849" />
<path
d="m 91.280352,300.63947 q 0,-0.18087 0.113688,-0.3049 0.118856,-0.12919 0.325562,-0.12919 0.206706,0 0.325561,0.12919 0.118856,0.12403 0.118856,0.3049 0,0.18086 -0.118856,0.29972 -0.118855,0.11369 -0.325561,0.11369 -0.206706,0 -0.325562,-0.11369 -0.113688,-0.11886 -0.113688,-0.29972 z"
style="letter-spacing:-0.26458332px;fill:#ffffff;stroke-width:0.26458332"
id="path851" />
<path
d="m 99.242655,301.01154 h -0.279052 l -4.857585,-7.04867 v 7.04867 h -0.28422 v -7.52409 h 0.28422 l 4.857585,7.03316 v -7.03316 h 0.279052 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Thin';-inkscape-font-specification:'Roboto Thin, '"
id="path853" />
<path
d="m 105.0914,297.2805 h -3.77238 v 3.45198 h 4.29948 v 0.27906 h -4.57854 v -7.52409 h 4.57854 v 0.27905 h -4.29948 v 3.23494 h 3.77238 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Thin';-inkscape-font-specification:'Roboto Thin, '"
id="path855" />
<path
d="m 111.92198,293.7665 h -2.73885 v 7.24504 h -0.27905 v -7.24504 h -2.73885 v -0.27905 h 5.75675 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Thin';-inkscape-font-specification:'Roboto Thin, '"
id="path857" />
</g>
</g>
</svg>

+ 19
- 0
src/TensorFlowNET.Core/APIs/tf.control.cs View File

@@ -14,10 +14,29 @@
limitations under the License.
******************************************************************************/

using System;

namespace Tensorflow
{
public static partial class tf
{
public static Tensor while_loop(Func<Tensor, Tensor> cond, Func<Tensor, Tensor> body, Tensor[] loop_vars,
TensorShape shape_invariants = null,
int parallel_iterations = 10,
bool back_prop = true,
bool swap_memory = false,
string name = null,
int? maximum_iterations = null,
bool return_same_structure = false)
=> control_flow_ops.while_loop(cond, body, loop_vars,
shape_invariants: shape_invariants,
parallel_iterations: parallel_iterations,
back_prop: back_prop,
swap_memory: swap_memory,
name: name,
maximum_iterations: maximum_iterations,
return_same_structure: return_same_structure);

public static _ControlDependenciesController control_dependencies(Operation[] control_inputs)
=> ops.control_dependencies(control_inputs);
}


+ 5
- 2
src/TensorFlowNET.Core/APIs/tf.math.cs View File

@@ -39,8 +39,8 @@ namespace Tensorflow
public static Tensor asin(Tensor x, string name = null)
=> gen_math_ops.asin(x, name);

public static Tensor add<Tx, Ty>(Tx a, Ty b)
=> gen_math_ops.add(a, b);
public static Tensor add<Tx, Ty>(Tx a, Ty b, string name = null)
=> gen_math_ops.add(a, b, name: name);

/// <summary>
/// Computes atan of x element-wise.
@@ -198,6 +198,9 @@ namespace Tensorflow
public static Tensor logical_or(Tensor x, Tensor y, string name = null)
=> gen_math_ops.logical_or(x, y, name);

public static Tensor logical_xor(Tensor x, Tensor y, string name = "LogicalXor")
=> gen_math_ops.logical_xor(x, y, name);

/// <summary>
/// Clips tensor values to a specified min and max.
/// </summary>


+ 0
- 5
src/TensorFlowNET.Core/Framework/Models/ScopedTFGraph.cs View File

@@ -6,10 +6,5 @@
{

}

~ScopedTFGraph()
{
base.Dispose();
}
}
}

+ 1
- 1
src/TensorFlowNET.Core/Graphs/Graph.Control.cs View File

@@ -33,7 +33,7 @@ namespace Tensorflow
/// </summary>
/// <param name="input_ops">The data input ops for an op to be created.</param>
/// <returns>A list of control inputs for the op to be created.</returns>
private ITensorOrOperation[] _control_dependencies_for_inputs(ITensorOrOperation[] input_ops)
public ITensorOrOperation[] _control_dependencies_for_inputs(ITensorOrOperation[] input_ops)
{
var ret = new List<ITensorOrOperation>();



+ 0
- 1
src/TensorFlowNET.Core/Graphs/Graph.cs View File

@@ -445,7 +445,6 @@ namespace Tensorflow
protected override void DisposeUnManagedState(IntPtr handle)
{
Console.WriteLine($"Destroy graph {handle}");
c_api.TF_DeleteGraph(handle);
}



+ 36
- 0
src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs View File

@@ -53,6 +53,11 @@ namespace Tensorflow.Operations
protected Stack<ControlFlowContext> _context_stack;
protected ControlFlowContext _outer_context;

/// <summary>
/// The keys are the names of tensors referenced by but external to this
/// context. Each value is the Tensor that should be used by this context to
/// access the key value (e.g. a switch output guarding a cond input value).
/// </summary>
protected Dictionary<string, ITensorOrOperation> _external_values;

public ControlFlowContext()
@@ -68,6 +73,12 @@ namespace Tensorflow.Operations
_outer_context = ops.get_default_graph()._get_control_flow_context();
if (values_def != null)
_init_values_from_proto(values_def, import_scope: import_scope);
else
{
_values = new HashSet<string>();
_external_values = new Dictionary<string, ITensorOrOperation>();
}

}

public void __enter__()
@@ -114,6 +125,27 @@ namespace Tensorflow.Operations
graph._set_control_flow_context(this);
}

protected virtual Tensor _Enter(Tensor data, string frame_name,
bool is_constant = false,
int parallel_iterations = 10,
bool use_ref = true,
bool use_input_shape = true,
string name = null)
{
Tensor result;
data = ops.internal_convert_to_tensor_or_indexed_slices(data, as_ref: true);
if (data.dtype.is_ref_dtype() && use_ref)
throw new NotImplementedException("_Enter");
else
result = gen_control_flow_ops.enter(
data, frame_name, is_constant, parallel_iterations, name: name);

if (use_input_shape)
result.SetShape(data.TensorShape);

return result;
}

/// <summary>
/// Exit this control flow context.
/// </summary>
@@ -184,6 +216,10 @@ namespace Tensorflow.Operations
return true;
}

protected virtual bool _IsInOuterContext(Operation op)
{
throw new NotImplementedException("_IsInOuterContext");
}

protected virtual void _RemoveExternalControlEdges(Operation op)
{


+ 165
- 12
src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs View File

@@ -15,8 +15,12 @@
******************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using Tensorflow.Operations.ControlFlows;
using Tensorflow.Util;
using static Tensorflow.Python;
using static Tensorflow.control_flow_ops;

namespace Tensorflow.Operations
{
@@ -32,10 +36,14 @@ namespace Tensorflow.Operations
bool _swap_memory;
Tensor _pivot_for_pred;
Tensor _pivot_for_body;
Tensor[] _loop_exits;
Tensor[] _loop_enters;
List<Tensor> _loop_exits;
List<Tensor> _loop_enters;
Graph _graph;
public override GradLoopState grad_state => _grad_state;
public override bool back_prop => _back_prop;

public WhileContext(int parallel_iterations = 10,
public WhileContext(int? maximum_iterations = null,
int parallel_iterations = 10,
bool back_prop = true,
bool swap_memory = false,
string name = "while_context",
@@ -49,12 +57,27 @@ namespace Tensorflow.Operations
}
else
{
__init__();
_init_from_args(maximum_iterations, parallel_iterations, back_prop, swap_memory, name);
}

_grad_state = grad_state;
}

private void _init_from_args(int? maximum_iterations,
int parallel_iterations,
bool back_prop,
bool swap_memory,
string name)
{
_name = ops.get_default_graph().unique_name(name);
_back_prop = back_prop;
_swap_memory = swap_memory;
_loop_exits = new List<Tensor>();
_loop_enters = new List<Tensor>();
_graph = ops.get_default_graph();
}

private void _init_from_proto(WhileContextDef context_def, string import_scope = null)
{
var g = ops.get_default_graph();
@@ -70,26 +93,156 @@ namespace Tensorflow.Operations
// The boolean tensor for loop termination condition.
_pivot = g.as_graph_element(ops.prepend_name_scope(context_def.PivotName, import_scope)) as Tensor;
// The list of exit tensors for loop variables.
_loop_exits = new Tensor[context_def.LoopExitNames.Count];
_loop_exits = new List<Tensor>();
foreach (var (i, exit_name) in enumerate(context_def.LoopExitNames))
_loop_exits[i] = g.as_graph_element(ops.prepend_name_scope(exit_name, import_scope)) as Tensor;
_loop_exits.Add(g.as_graph_element(ops.prepend_name_scope(exit_name, import_scope)) as Tensor);
// The list of enter tensors for loop variables.
_loop_enters = new Tensor[context_def.LoopEnterNames.Count];
_loop_enters = new List<Tensor>();
foreach (var (i, enter_name) in enumerate(context_def.LoopEnterNames))
_loop_enters[i] = g.as_graph_element(ops.prepend_name_scope(enter_name, import_scope)) as Tensor;
_loop_enters.Add(g.as_graph_element(ops.prepend_name_scope(enter_name, import_scope)) as Tensor);

__init__(values_def: context_def.ValuesDef, import_scope: import_scope);
}

public override WhileContext GetWhileContext()
/// <summary>
/// Add the loop termination condition and body to the graph.
/// </summary>
public Tensor[] BuildLoop(Func<Tensor, Tensor> pred,
Func<Tensor, Tensor> body,
Tensor[] loop_vars,
TensorShape shape_invariants,
bool return_same_structure)
{
return this;
// Keep original_loop_vars to identify which are TensorArrays
var original_loop_vars = loop_vars;
// Convert TensorArrays to their flow variables
Enter();
var(original_body_result, exit_vars) = _BuildLoop(
pred, body, original_loop_vars, loop_vars, shape_invariants);
Exit();

var flat_result = original_body_result;

var exit_vars_with_tensor_arrays = _convert_flows_to_tensorarrays(flat_result, exit_vars);
var packed_exit_vars = nest.pack_sequence_as(
structure: original_body_result,
flat_sequence: exit_vars_with_tensor_arrays);

return packed_exit_vars as Tensor[];
}

private (Tensor[], Tensor[]) _BuildLoop(Func<Tensor, Tensor> pred,
Func<Tensor, Tensor> body,
Tensor[] original_loop_vars,
Tensor[] loop_vars,
TensorShape shape_invariants)
{
var flat_loop_vars = original_loop_vars;

public override GradLoopState grad_state => _grad_state;
// Let the context know the loop variables so the loop variables
// would be added in the outer contexts properly.
_InitializeValues(loop_vars);
var real_vars = loop_vars;
Tensor[] enter_vars = null;
tf_with(ops.control_dependencies(null), delegate
{
enter_vars = real_vars.Select(x => _Enter(x,
_name,
is_constant: false,
parallel_iterations: _parallel_iterations,
use_input_shape: shape_invariants == null))
.ToArray();

public override bool back_prop => _back_prop;
foreach(var x in enter_vars)
{
x.graph.prevent_feeding(x);
if (_outer_context != null)
_outer_context.AddInnerOp(x.op);
}
});

// Finds the closest enclosing non-None control pivot.
var outer_context = _outer_context;
while (outer_context != null)
{

}

_SetShapeInvariants(real_vars, enter_vars, shape_invariants);

// Fix the control inputs and control flow context of these enter ops.
_FixControlInputsAndContext(enter_vars);
_InitializeValues(enter_vars);
_loop_enters = enter_vars.ToList();

var merge_vars = enter_vars
.Select(x => merge(new[] { x, x }))
.ToArray();

_pivot_for_pred = merge_vars[0];

// Build the graph for pred.
var merge_vars_with_tensor_arrays = _convert_flows_to_tensorarrays(flat_loop_vars, merge_vars);
// var packed_vars = nest.pack_sequence_as(original_loop_vars, merge_vars_with_tensor_arrays);
var c = ops.convert_to_tensor(pred(merge_vars_with_tensor_arrays[0]));
_pivot = gen_control_flow_ops.loop_cond(c, name: "LoopCond");
var switch_vars = merge_vars.Select(x => _SwitchRefOrTensor(x, _pivot))
.ToArray();

// Build the graph for body.
var vars_for_body = switch_vars.Select(x => _Identity(x[1])).ToArray();
// Convert TensorArray flow variables inside the context back into
// their associated TensorArrays for calling the body.
var packed_vars_for_body = _convert_flows_to_tensorarrays(flat_loop_vars, vars_for_body);
var body_result = body(packed_vars_for_body[0]);
var post_summaries = ops.get_collection(ops.GraphKeys._SUMMARY_COLLECTION);

// Store body_result to keep track of TensorArrays returned by body
var original_body_result = new[] { body_result };
// Convert TensorArrays returned by body into their flow variables
var result = new[] { body_result };

var next_vars = new List<Tensor>();
foreach (var (m, v) in zip(merge_vars, result))
next_vars.Add(_AddNextAndBackEdge(m, v));

// Add the exit ops.
var exit_vars = switch_vars.Select(x => exit(x[0])).ToList();
_loop_exits = exit_vars;

// Exit the loop.
// ExitResult(exit_vars);
return (original_body_result, exit_vars.ToArray());
}

private void _FixControlInputsAndContext(Tensor[] enters)
{
var graph = ops.get_default_graph();
foreach(var e in enters)
{
var inp_op = e.op.inputs[0].op;
var control_inputs = graph._control_dependencies_for_inputs(new[] { inp_op });
// op for op in control_inputs if self._IsInOuterContext(op)
var outer_control_inputs = control_inputs.Where(x => _IsInOuterContext(x.op))
.Select(x => x.op)
.ToArray();
e.op._set_control_flow_context(this);
e.op._add_control_inputs(outer_control_inputs);
graph._record_op_seen_by_control_dependencies(e.op);
}
}

private void _InitializeValues(Tensor[] values)
{
_values = new HashSet<string>();
foreach(var x in values)
_values.Add(x.name);
}

public override WhileContext GetWhileContext()
{
return this;
}

public WhileContext from_proto(WhileContextDef proto, string import_scope)
{


+ 34
- 7
src/TensorFlowNET.Core/Operations/NnOps/rnn.cs View File

@@ -142,30 +142,57 @@ namespace Tensorflow.Operations
string base_name = null;
tf_with(ops.name_scope("dynamic_rnn"), scope => base_name = scope);

Func<string, TensorShape, TF_DataType, Tensor> _create_ta = (name, element_shape, dtype_) =>
Func<string, TensorShape, TF_DataType, TensorArray> _create_ta = (name, element_shape, dtype_) =>
{
new TensorArray(dtype: dtype_,
var ta = new TensorArray(dtype: dtype_,
size: time_steps,
element_shape: element_shape,
tensor_array_name: base_name + name);
throw new NotImplementedException("");
return ta;
};

bool in_graph_mode = true;
var output_ta = new List<TensorArray>();
var input_ta = new List<TensorArray>();
if (in_graph_mode)
{
foreach(var (i, out_size) in enumerate(flat_output_size))
foreach (var (i, out_size) in enumerate(flat_output_size))
{
_create_ta($"output_{i}",
output_ta.Add(_create_ta($"output_{i}",
new TensorShape(const_batch_size).concatenate(
_maybe_tensor_shape_from_tensor(out_size)),
_infer_state_dtype(dtype, state));
_infer_state_dtype(dtype, state)));
}

foreach (var (i, flat_input_i) in enumerate(flat_input))
{
input_ta.Add(_create_ta($"input_{i}",
new TensorShape(flat_input_i.dims.Skip(1).ToArray()),
flat_input_i.dtype));
}

for (int i = 0; i < input_ta.Count; i++)
{
var (ta, input_) = (input_ta[0], flat_input[0]);
}
}

// Make sure that we run at least 1 step, if necessary, to ensure
// the TensorArrays pick up the dynamic shape.
Tensor loop_bound;
if (in_graph_mode)
loop_bound = math_ops.minimum(
time_steps, math_ops.maximum(1, max_sequence_length));

/*Func<Tensor, Tensor> cond = (ctime) =>
{
return null;
};

control_flow_ops.while_loop(
cond: cond,
body = );*/

throw new NotImplementedException("");
}



+ 91
- 3
src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs View File

@@ -26,6 +26,44 @@ namespace Tensorflow
{
public class control_flow_ops
{
public static Tensor _AddNextAndBackEdge(Tensor m, Tensor v, bool enforce_shape_invariant = true)
{
v = ops.convert_to_tensor(v);
v = _NextIteration(v);
if (enforce_shape_invariant)
_EnforceShapeInvariant(m, v);
m.op._update_input(1, v);
return v;
}

/// <summary>
/// Check if the shapes of the loops variables are invariants.
/// </summary>
/// <param name="merge_var"></param>
/// <param name="next_var"></param>
public static void _EnforceShapeInvariant(Tensor merge_var, Tensor next_var)
{

}

public static Tensor exit(Tensor data, string name = null)
{
data = ops.internal_convert_to_tensor_or_indexed_slices(data, as_ref: true);
if (data.dtype.is_ref_dtype())
return gen_control_flow_ops.ref_exit(data, name: name);
else
return gen_control_flow_ops._exit(data, name: name);
}

public static Tensor _NextIteration(Tensor data, string name = null)
{
data = ops.internal_convert_to_tensor_or_indexed_slices(data, as_ref: true);
if (data.dtype.is_ref_dtype())
return gen_control_flow_ops.ref_next_iteration(data, name: name);
else
return gen_control_flow_ops.next_iteration(data, name: name);
}

public static Operation Assert(Tensor condition, object[] data, int? summarize = null, string name = null)
{
return tf_with(ops.name_scope(name, "Assert", new { condition, data }), scope =>
@@ -213,6 +251,14 @@ namespace Tensorflow
return gen_array_ops.identity(data, name: name);
}

public static void _SetShapeInvariants(Tensor[] input_vars, Tensor[] enter_vars, TensorShape shapes = null)
{
if (shapes == null)
return;

throw new NotImplementedException("_SetShapeInvariants");
}

/// <summary>
/// Forwards `data` to an output determined by `pred`.
/// If `pred` is false, the `data` input is forwarded to the first output.
@@ -516,10 +562,52 @@ namespace Tensorflow
throw new NotImplementedException("ZerosLikeOutsideLoop");
}

// TODO
public static void while_loop(Func<Tensor, Tensor> func, Func<Tensor, Tensor> func1, Tensor[] tensors, int? i)
/// <summary>
/// Repeat `body` while the condition `cond` is true.
/// </summary>
/// <param name="cond"></param>
/// <param name="body"></param>
/// <param name="loop_vars"></param>
/// <param name="i"></param>
public static Tensor while_loop(Func<Tensor, Tensor> cond, Func<Tensor, Tensor> body, Tensor[] loop_vars,
TensorShape shape_invariants = null,
int parallel_iterations = 10,
bool back_prop = true,
bool swap_memory = false,
string name = null,
int? maximum_iterations = null,
bool return_same_structure = false)
{
throw new NotImplementedException();
tf_with(ops.name_scope(name, "while", loop_vars), scope =>
{
if (loop_vars == null || loop_vars.Length == 0)
throw new ValueError("No loop variables provided");
if (cond == null)
throw new ValueError("cond must be callable.");
if (body == null)
throw new ValueError("body must be callable.");
if (parallel_iterations < 1)
throw new ValueError("parallel_iterations must be a positive integer.");

var loop_context = new WhileContext(
maximum_iterations: maximum_iterations,
parallel_iterations: parallel_iterations,
back_prop: back_prop,
swap_memory: swap_memory);

if (loop_context.outer_context == null)
ops.add_to_collection(ops.GraphKeys.WHILE_CONTEXT, loop_context);

var results = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants,
return_same_structure);

if (maximum_iterations != null)
return results[1];
else
return results[0];
});

throw new NotImplementedException("while_loop");
}

}


+ 87
- 0
src/TensorFlowNET.Core/Operations/gen_control_flow_ops.py.cs View File

@@ -20,6 +20,93 @@ namespace Tensorflow
{
public static OpDefLibrary _op_def_lib = new OpDefLibrary();

/// <summary>
/// Creates or finds a child frame, and makes `data` available to the child frame.
/// </summary>
/// <param name="data"></param>
/// <param name="frame_name"></param>
/// <param name="is_constant"></param>
/// <param name="parallel_iterations"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor enter(Tensor data, string frame_name = "frame_name", bool is_constant = false, int parallel_iterations = 10, string name = null)
{
var _op = _op_def_lib._apply_op_helper("Enter", name, new
{
data,
frame_name,
is_constant,
parallel_iterations
});

return _op.output;
}

/// <summary>
/// Forwards the input to the output.
/// </summary>
/// <param name="input"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor loop_cond(Tensor input, string name = null)
{
var _op = _op_def_lib._apply_op_helper("LoopCond", name, new { input });

return _op.output;
}

/// <summary>
/// Makes its input available to the next iteration.
/// </summary>
/// <param name="data"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor ref_next_iteration(Tensor data, string name = null)
{
var _op = _op_def_lib._apply_op_helper("RefNextIteration", name, new { data });

return _op;
}

/// <summary>
/// Makes its input available to the next iteration.
/// </summary>
/// <param name="data"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor next_iteration(Tensor data, string name = null)
{
var _op = _op_def_lib._apply_op_helper("NextIteration", name, new { data });

return _op;
}

/// <summary>
/// Exits the current frame to its parent frame.
/// </summary>
/// <param name="data"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor ref_exit(Tensor data, string name = null)
{
var _op = _op_def_lib._apply_op_helper("RefExit", name, new { data });

return _op;
}

/// <summary>
/// Exits the current frame to its parent frame.
/// </summary>
/// <param name="data"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Tensor _exit(Tensor data, string name = null)
{
var _op = _op_def_lib._apply_op_helper("Exit", name, new { data });

return _op;
}

public static Operation no_op(string name = null)
{
var _op = _op_def_lib._apply_op_helper("NoOp", name, null);


+ 8
- 0
src/TensorFlowNET.Core/Operations/gen_math_ops.cs View File

@@ -371,6 +371,14 @@ namespace Tensorflow
return _op.outputs[0];
}
public static Tensor logical_xor(Tensor x, Tensor y, string name = "LogicalXor")
{
return logical_and(
logical_or(x, y),
logical_not(logical_and(x, y)),
name);
}
public static Tensor squared_difference(Tensor x, Tensor y, string name = null)
{
var _op = _op_def_lib._apply_op_helper("SquaredDifference", name, args: new { x, y, name });


+ 3
- 0
src/TensorFlowNET.Core/Operations/math_ops.cs View File

@@ -516,6 +516,9 @@ namespace Tensorflow
});
}

public static Tensor minimum<Tx, Ty>(Tx x, Ty y, string name = null)
=> gen_math_ops.minimum(x, y, name: name);

public static Tensor maximum<Tx, Ty>(Tx x, Ty y, string name = null)
=> gen_math_ops.maximum(x, y, name: name);



+ 6
- 5
src/TensorFlowNET.Core/TensorFlowNET.Core.csproj View File

@@ -5,7 +5,7 @@
<AssemblyName>TensorFlow.NET</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>1.14.0</TargetTensorFlow>
<Version>0.10.10</Version>
<Version>0.10.11</Version>
<Authors>Haiping Chen, Meinrad Recheis</Authors>
<Company>SciSharp STACK</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -17,7 +17,7 @@
<PackageTags>TensorFlow, NumSharp, SciSharp, MachineLearning, TensorFlow.NET, C#</PackageTags>
<Description>Google's TensorFlow full binding in .NET Standard.
Docs: https://tensorflownet.readthedocs.io</Description>
<AssemblyVersion>0.10.10.0</AssemblyVersion>
<AssemblyVersion>0.10.11.0</AssemblyVersion>
<PackageReleaseNotes>Changes since v0.9.0:

1. Added full connected Convolution Neural Network example.
@@ -35,9 +35,10 @@ Docs: https://tensorflownet.readthedocs.io</Description>
13. Fix default graph and operation issue when import model.
14. Fix TF_String endcode and decode.
15. Fix Tensor memory leak.
16. Rename with to tf_with that is only used to build graph purpose.</PackageReleaseNotes>
<LangVersion>7.3</LangVersion>
<FileVersion>0.10.10.0</FileVersion>
16. Rename with to tf_with that is only used to build graph purpose.
17. Graph inherit from DisposableObject.</PackageReleaseNotes>
<LangVersion>7.2</LangVersion>
<FileVersion>0.10.11.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly>


+ 1
- 1
src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs View File

@@ -655,7 +655,7 @@ namespace Tensorflow
if (args.deallocator_called || args.gc_handle == IntPtr.Zero)
return;
// note: since the ptr given to tensorflow is just the addr of the pinned object we can not directly free it! we need to free the gcHandle instead
GCHandle.FromIntPtr(args.gc_handle).Free();
//args.gchandle.Free();
args.deallocator_called = true;
}



+ 6
- 0
src/TensorFlowNET.Core/Tensors/Tensor.cs View File

@@ -392,6 +392,11 @@ namespace Tensorflow
return $"tf.Tensor '{name}' shape=({string.Join(",", shape)}) dtype={dtype}";
}

protected override void DisposeManagedState()
{
if (gcHandle.IsAllocated)
gcHandle.Free();
}
protected override void DisposeUnManagedState(IntPtr handle)
{
if(handle != IntPtr.Zero)
@@ -411,5 +416,6 @@ namespace Tensorflow
}
}

public int tensor_int_val { get; set; }
}
}

+ 10
- 1
src/TensorFlowNET.Core/Tensors/TensorShape.cs View File

@@ -70,7 +70,16 @@ namespace Tensorflow
if (ndim < 0 || other.ndim < 0)
return new TensorShape();
else
return new TensorShape(ndim + other.ndim);
{
var concatenate_dims = new int[NDim + other.NDim];
for (int i = 0; i < NDim; i++)
concatenate_dims[i] = dims[i];

for (int i = 0; i < other.NDim; i++)
concatenate_dims[NDim + i] = other.dims[i];

return new TensorShape(concatenate_dims);
}
}

public static implicit operator TensorShape(Shape shape) => new TensorShape(shape.Dimensions);


+ 9
- 0
test/TensorFlowNET.UnitTest/OperationsTest.cs View File

@@ -162,6 +162,15 @@ namespace TensorFlowNET.UnitTest
var o = sess.run(d);
Assert.IsTrue(o.array_equal(check));
}

d = tf.cast(tf.logical_xor(b, c), tf.int32);
check = np.array(new[] { 1, 1, 1, 1, 1, 1, 1, 1 });

using (var sess = tf.Session())
{
var o = sess.run(d);
Assert.IsTrue(o.array_equal(check));
}
}

[TestMethod]


+ 13
- 1
test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs View File

@@ -8,6 +8,18 @@ namespace TensorFlowNET.UnitTest.control_flow_ops_test
[TestClass]
public class WhileContextTestCase : PythonTest
{
/// <summary>
/// https://www.tensorflow.org/api_docs/python/tf/while_loop
/// </summary>
[TestMethod]
public void SimpleWhileLoop()
{
var i = constant_op.constant(0, name: "i");
var c = new Func<Tensor, Tensor>(x => tf.less(x, 10, name: "c"));
var b = new Func<Tensor, Tensor>(x => tf.add(x, 1, name: "c"));
var r = control_flow_ops.while_loop(c, b, new[] { i });
}
private void _testWhileContextHelper(int? maximum_iterations = null)
{
// TODO: implement missing code dependencies
@@ -17,7 +29,7 @@ namespace TensorFlowNET.UnitTest.control_flow_ops_test
var c = new Func<Tensor, Tensor>(x => gen_math_ops.less(x, 10, name: "c"));
var b = new Func<Tensor, Tensor>(x => gen_math_ops.add(x, 1, name: "c"));
control_flow_ops.while_loop(
c, b, new[] { i }, maximum_iterations);
c, b, new[] { i }, maximum_iterations: maximum_iterations);
foreach (Operation op in sess.graph.get_operations())
{
var control_flow_context = op._get_control_flow_context();


Loading…
Cancel
Save