6 |
--------------------------------------------------------------------------------
/docs/_includes/homeheader.html:
--------------------------------------------------------------------------------
1 | {% include head.html %}
2 |
3 |
4 |
12 |
--------------------------------------------------------------------------------
/docs/_layouts/default.html:
--------------------------------------------------------------------------------
1 | {% include header.html %}
2 |
3 |
4 |
5 |
6 |
7 | {{ content }}
8 |
9 |
10 |
11 |
12 |
13 | {% include footer.html %}
--------------------------------------------------------------------------------
/docs/_layouts/home.html:
--------------------------------------------------------------------------------
1 | {% include homeheader.html %}
2 |
3 |
4 |
5 |
6 |
7 | {{ content }}
8 |
9 |
10 |
11 |
12 |
13 | {% include footer.html %}
--------------------------------------------------------------------------------
/docs/assets/css/ie10-viewport-bug-workaround.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * IE10 viewport hack for Surface/desktop Windows 8 bug
3 | * Copyright 2014-2015 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 |
7 | /*
8 | * See the Getting Started docs for more information:
9 | * http://getbootstrap.com/getting-started/#support-ie10-width
10 | */
11 | @-ms-viewport { width: device-width; }
12 | @-o-viewport { width: device-width; }
13 | @viewport { width: device-width; }
14 |
--------------------------------------------------------------------------------
/docs/assets/js/ie10-viewport-bug-workaround.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * IE10 viewport hack for Surface/desktop Windows 8 bug
3 | * Copyright 2014-2015 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 |
7 | // See the Getting Started docs for more information:
8 | // http://getbootstrap.com/getting-started/#support-ie10-width
9 |
10 | (function () {
11 | 'use strict';
12 |
13 | if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
14 | var msViewportStyle = document.createElement('style')
15 | msViewportStyle.appendChild(
16 | document.createTextNode(
17 | '@-ms-viewport{width:auto!important}'
18 | )
19 | )
20 | document.querySelector('head').appendChild(msViewportStyle)
21 | }
22 |
23 | })();
24 |
--------------------------------------------------------------------------------
/docs/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/background.jpg
--------------------------------------------------------------------------------
/docs/css/gallery.scss:
--------------------------------------------------------------------------------
1 | ---
2 | # this ensures Jekyll reads the file to be transformed into CSS later
3 | # only Main files contain this front matter, not partials.
4 | ---
5 |
6 | //
7 | // Model gallery
8 | // --------------------------------------------------
9 |
10 | // Padding for cells in `.arch-table`.
11 | $arch-table-cell-padding: 3px !default;
12 |
13 | // Model architecture nested table
14 | .arch-table {
15 | border-style: none;
16 | > tr {
17 | padding: $arch-table-cell-padding;
18 | }
19 | > th,
20 | > td {
21 | border-style: none;
22 | padding: $arch-table-cell-padding;
23 | }
24 | }
25 |
26 | .table-auto {
27 | width: auto !important;
28 | }
--------------------------------------------------------------------------------
/docs/css/theme.scss:
--------------------------------------------------------------------------------
1 | ---
2 | # this ensures Jekyll reads the file to be transformed into CSS later
3 | # only Main files contain this front matter, not partials.
4 | ---
5 |
6 | // Make images responsive by default.
7 | // Note: If we can reference bootstrap.scss directly, this can be simplified to @include .img-responsive;
8 | img {
9 | display:block;
10 | height: auto;
11 | max-width: 100%;
12 | }
13 |
--------------------------------------------------------------------------------
/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-With-Offsets.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-With-Offsets.jpg
--------------------------------------------------------------------------------
/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-With-Offsets.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-With-Offsets.stl
--------------------------------------------------------------------------------
/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-Without-Offsets.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-Without-Offsets.jpg
--------------------------------------------------------------------------------
/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-Without-Offsets.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/gallery/Raspberry-Pi-3-Fan-Mount/Raspberry-Pi-3-Fan-Mount-Without-Offsets.stl
--------------------------------------------------------------------------------
/docs/gallery/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: ELL Gallery
4 | permalink: /gallery/
5 | ---
6 |
7 | # The ELL Gallery
8 |
9 | Our gallery is a collection of bits and pieces that you can download and use in your projects.
10 |
11 | ### Image Classification Models
12 |
13 | - [ILSVRC2012](/ELL/gallery/ILSVRC2012/) gallery
14 |
15 | ### Audio Keyword Spotting Models
16 |
17 | - [Speech Commands](/ELL/gallery/speech_commands_v0.01/) gallery
18 |
19 | ### 3D Designs
20 |
21 | - [Raspberry Pi 3 Fan Mount](/ELL/gallery/Raspberry-Pi-3-Fan-Mount)
22 |
--------------------------------------------------------------------------------
/docs/js/data.js:
--------------------------------------------------------------------------------
1 |
2 | function loadJSON(filename, callback) {
3 | var xobj = new XMLHttpRequest();
4 | xobj.overrideMimeType("application/json");
5 | xobj.open('GET', filename, true);
6 | xobj.onreadystatechange = function () {
7 | if (xobj.readyState == 4 && xobj.status == "200") {
8 | // Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
9 | callback(xobj.responseText);
10 | }
11 | };
12 | xobj.send(null);
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Attach-Fan-to-Mount.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Attach-Fan-to-Mount.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Cluster.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Cluster.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-3-IR.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-3-IR.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-Active-Cooling-Materials.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-Active-Cooling-Materials.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-with-Fan-on-Display.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-with-Fan-on-Display.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-with-Fan.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Pi-with-Fan.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Two-Mount-Designs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Active-cooling-your-Raspberry-Pi-3/Two-Mount-Designs.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/Screenshot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/Screenshot.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/cats.txt:
--------------------------------------------------------------------------------
1 | 281
2 | 282
3 | 283
4 | 284
5 | 285
6 | 286
7 | 287
8 | 288
9 | 289
10 | 290
11 | 291
12 | 292
13 | 293
14 |
--------------------------------------------------------------------------------
/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/dogs.txt:
--------------------------------------------------------------------------------
1 | 151
2 | 152
3 | 153
4 | 154
5 | 155
6 | 156
7 | 157
8 | 158
9 | 159
10 | 160
11 | 161
12 | 162
13 | 163
14 | 165
15 | 166
16 | 167
17 | 169
18 | 170
19 | 171
20 | 172
21 | 173
22 | 174
23 | 175
24 | 176
25 | 177
26 | 178
27 | 179
28 | 180
29 | 181
30 | 182
31 | 183
32 | 184
33 | 185
34 | 186
35 | 187
36 | 188
37 | 189
38 | 190
39 | 191
40 | 193
41 | 195
42 | 196
43 | 197
44 | 198
45 | 199
46 | 200
47 | 201
48 | 202
49 | 203
50 | 204
51 | 205
52 | 206
53 | 207
54 | 208
55 | 209
56 | 210
57 | 211
58 | 212
59 | 213
60 | 215
61 | 217
62 | 218
63 | 219
64 | 220
65 | 221
66 | 222
67 | 223
68 | 224
69 | 229
70 | 230
71 | 231
72 | 232
73 | 232
74 | 234
75 | 235
76 | 236
77 | 237
78 | 238
79 | 239
80 | 240
81 | 241
82 | 242
83 | 243
84 | 244
85 | 245
86 | 246
87 | 247
88 | 248
89 | 249
90 | 250
91 | 251
92 | 252
93 | 253
94 | 254
95 | 256
96 | 257
97 | 259
98 | 260
99 | 262
100 | 263
101 | 264
102 | 265
103 | 266
104 | 267
105 | 268
106 | 275
107 | 295
108 | 474
109 |
--------------------------------------------------------------------------------
/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Boosting-classifier-accuracy-by-grouping-categories/thumbnail.png
--------------------------------------------------------------------------------
/docs/tutorials/Comparing-image-classification-models-side-by-side-on-the-Raspberry-Pi/Screenshot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Comparing-image-classification-models-side-by-side-on-the-Raspberry-Pi/Screenshot.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Getting-started-with-audio-keyword-spotting-on-the-Raspberry-Pi/seven.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Getting-started-with-audio-keyword-spotting-on-the-Raspberry-Pi/seven.wav
--------------------------------------------------------------------------------
/docs/tutorials/Getting-started-with-audio-keyword-spotting-on-the-Raspberry-Pi/spectrogram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Getting-started-with-audio-keyword-spotting-on-the-Raspberry-Pi/spectrogram.png
--------------------------------------------------------------------------------
/docs/tutorials/Getting-started-with-image-classification-in-cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 | project(tutorial)
3 | set(CMAKE_CXX_STANDARD 11)
4 |
5 | # Change this to set OpenCV_DIR to your opencv/build location
6 | set(OpenCV_DIR C:/Install/OpenCV3/opencv/build)
7 |
8 | add_subdirectory(model)
9 |
10 | find_package(OpenCV REQUIRED)
11 | add_executable(tutorial tutorial.cpp)
12 | target_link_libraries(tutorial ${OpenCV_LIBS} model)
13 |
--------------------------------------------------------------------------------
/docs/tutorials/Getting-started-with-image-classification-in-cpp/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Getting-started-with-image-classification-in-cpp/Screenshot.png
--------------------------------------------------------------------------------
/docs/tutorials/Getting-started-with-image-classification-on-the-Raspberry-Pi/Screenshot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Getting-started-with-image-classification-on-the-Raspberry-Pi/Screenshot.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Getting-started-with-object-detection-using-region-of-interest-networks/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Getting-started-with-object-detection-using-region-of-interest-networks/Screenshot.png
--------------------------------------------------------------------------------
/docs/tutorials/Notes-on-playing-audio/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | title: Notes on playing audio
4 | permalink: /tutorials/Notes-on-playing-audio/
5 | ---
6 | # Notes on playing audio
7 |
8 | *by Kern Handa*
9 |
10 | ## macOS
11 |
12 | To play audio using ELL's `play_sound` function in the `tutorialHelpers` module
13 | on macOS, the following command needs to be run:
14 |
15 | ```shell
16 | pip install -U PyObjC
17 | ```
18 |
19 | ## Raspberry Pi
20 |
21 | If an HDMI cable is used with the Raspberry Pi, an additional step is needed
22 | to route audio through the headphone jack.
23 |
24 | ```shell
25 | amixer cset numid=3 1
26 | ```
27 |
28 | The default behavior is to go to `auto`, which tends to be HDMI. To reset to
29 | the default behavior:
30 |
31 | ```shell
32 | amixer cset numid=3 0
33 | ```
34 |
--------------------------------------------------------------------------------
/docs/tutorials/Repurposing-a-pretrained-image-classifier/Screenshot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Repurposing-a-pretrained-image-classifier/Screenshot.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/GRUKeywordSpotter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/GRUKeywordSpotter.png
--------------------------------------------------------------------------------
/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/featurizer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/featurizer.png
--------------------------------------------------------------------------------
/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/process.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/process.jpg
--------------------------------------------------------------------------------
/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/vad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/Training-audio-keyword-spotter-with-pytorch/vad.png
--------------------------------------------------------------------------------
/docs/tutorials/shared/coffeemug.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/docs/tutorials/shared/coffeemug.jpg
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # SWIG example projects
3 | #
4 |
5 | add_subdirectory(data)
6 | add_subdirectory(python)
7 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | Example code for the Embedded Learning Library
2 |
3 |
--------------------------------------------------------------------------------
/examples/data/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # Example data files
3 | #
4 |
5 | set (DATA_FILES testData.txt tinyTestData.txt protonnTestData.txt seven.wav bed.wav)
6 |
7 | add_custom_target(dataFiles ALL DEPENDS ${DATA_FILES} SOURCES ${DATA_FILES})
8 | add_dependencies(dataFiles exampleModels)
9 | set_property(TARGET dataFiles PROPERTY FOLDER "examples")
10 |
11 | # copy example data
12 | foreach(DATA_FILE ${DATA_FILES})
13 | add_custom_command(TARGET dataFiles
14 | POST_BUILD
15 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
16 | COMMAND ${CMAKE_COMMAND} -E copy ${DATA_FILE} ${CMAKE_CURRENT_BINARY_DIR})
17 | endforeach()
18 |
--------------------------------------------------------------------------------
/examples/data/bed.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/examples/data/bed.wav
--------------------------------------------------------------------------------
/examples/data/makeTestData.py:
--------------------------------------------------------------------------------
1 |
2 | def generateDataset(numSamplesPerLabel, numDim):
3 | import numpy
4 | posCenter = numpy.random.uniform(-2, 2, numDim)
5 | negCenter = numpy.random.uniform(-2, 2, numDim)
6 | posData = numpy.random.normal(0.0, 1.0, (numSamplesPerLabel, numDim)) + posCenter
7 | posEx = numpy.hstack((numpy.ones((numSamplesPerLabel, 1)), posData))
8 | negData = numpy.random.normal(0.0, 1.0, (numSamplesPerLabel, numDim)) + negCenter
9 | negEx = numpy.hstack((-numpy.ones((numSamplesPerLabel, 1)), negData))
10 | dataset = numpy.vstack((posEx, negEx))
11 | numpy.random.shuffle(dataset)
12 | return dataset
13 |
14 | def writeFile(dataset, filename):
15 | with open(filename, 'w') as fp:
16 | for row in dataset:
17 | fp.write('{}'.format(row[0]))
18 | for i, v in enumerate(row[1:]):
19 | fp.write('\t{}:{}'.format(i+1, v))
20 | fp.write('\n')
21 |
--------------------------------------------------------------------------------
/examples/data/seven.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/examples/data/seven.wav
--------------------------------------------------------------------------------
/examples/data/tinyTestData.txt:
--------------------------------------------------------------------------------
1 | -1.0 0:1 1:1 2:2
2 | 1.0 0:1 1:0 2:2
3 | -1.0 0:1 1:1 2:2
4 | 1.0 0:1 1:0 2:2
5 | -1.0 0:1 1:1 2:2
6 | 1.0 0:2 1:1 2:2
7 | -1.0 0:1 1:1 2:2
8 | 1.0 0:2 1:1 2:2
9 | -1.0 0:2 1:1 2:3
10 | 1.0 0:2 1:1 2:2
11 | 1.0 0:2 1:1 2:2
12 | 1.0 0:2 1:1 2:2
13 | 1.0 0:2 1:1 2:2
14 | 1.0 0:2 1:1 2:2
15 | 1.0 0:2 1:1 2:2
--------------------------------------------------------------------------------
/examples/python/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # python example projects
3 | #
4 | set (PYTHON_EXAMPLES sgd.py run.bat run.sh)
5 | add_custom_target(python_examples ALL DEPENDS ${PYTHON_EXAMPLES} SOURCES ${PYTHON_EXAMPLES})
6 | set_property(TARGET python_examples PROPERTY FOLDER "examples")
7 |
8 | # copy python example code
9 | copy_newer_files(python_examples PYTHON_EXAMPLES)
--------------------------------------------------------------------------------
/examples/python/run.bat:
--------------------------------------------------------------------------------
1 | python -i sgd.py ../data/testData.txt
2 |
--------------------------------------------------------------------------------
/examples/python/run.sh:
--------------------------------------------------------------------------------
1 | /usr/bin/python -i sgd.py ../../../examples/data/testData.txt
2 |
3 |
--------------------------------------------------------------------------------
/external/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/interfaces/R/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # SWIG r interfaces
3 | #
4 |
5 | include (CommonInterfaces)
6 |
7 | generate_interface(r ${CMAKE_CURRENT_SOURCE_DIR} "" "")
8 | add_dependencies(ELL_r ELL_common)
9 |
10 |
--------------------------------------------------------------------------------
/interfaces/common/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # SWIG interface code common to all languages ("common" here doesn't mean the "common" library)
3 | #
4 | include (CommonInterfaces)
5 |
6 | set (INTERFACE_SRC src/ModelBuilderInterface.cpp
7 | src/ModelInterface.cpp
8 | src/NeuralNetworkPredictorInterface.cpp
9 | src/Ports.cpp
10 | src/TrainerInterface.cpp
11 | src/DatasetInterface.cpp)
12 |
13 | generate_interface(common ell ${CMAKE_CURRENT_SOURCE_DIR} "" "" "")
14 |
--------------------------------------------------------------------------------
/interfaces/common/ELL_javascript_post.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/ELL_javascript_pre.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/ELL_python_post.i:
--------------------------------------------------------------------------------
1 | // Propagate python callback exceptions
2 | %feature("director:except") {
3 | if ($error != NULL) {
4 | PyObject* ptype = nullptr;
5 | PyObject* pvalue = nullptr;
6 | PyObject* ptraceback = nullptr;
7 | PyErr_Fetch(&ptype, &pvalue, &ptraceback);
8 | PyErr_Restore(ptype, pvalue, ptraceback);
9 | PyErr_Print();
10 | Py_Exit(1);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/interfaces/common/ELL_python_pre.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
2 |
--------------------------------------------------------------------------------
/interfaces/common/callback_javascript_pre.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/callback_python_post.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/callback_python_pre.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/dataset.i:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: dataset.i (interfaces)
5 | // Authors: Chuck Jacobs, Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | %{
10 | //#define SWIG_FILE_WITH_INIT
11 | #include "DatasetInterface.h"
12 | %}
13 |
14 | %include "DatasetInterface.h"
15 |
--------------------------------------------------------------------------------
/interfaces/common/doc/CallbackDesign.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/interfaces/common/doc/CallbackDesign.png
--------------------------------------------------------------------------------
/interfaces/common/ell_py.i:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ell_py.i (interfaces)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | // we want a different "ell_py" module name for python so we can wrap it in a more python friendly
10 | // package named "ell"
11 |
12 | %module(moduleimport="import $module") "ell_py"
13 |
14 | %include "ell.i"
15 |
--------------------------------------------------------------------------------
/interfaces/common/evaluators.i:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: evaluators.i (interfaces)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | %{
10 | //#define SWIG_FILE_WITH_INIT
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | %}
17 |
18 | // Wrap some things with SWIG
19 |
20 | %include
21 | %include
22 |
--------------------------------------------------------------------------------
/interfaces/common/include/DatasetInterfaceImpl.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DatasetInterfaceImpl.h (interfaces)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | #include "DatasetInterface.h"
11 |
12 | #include
13 | #include
14 |
15 | namespace ELL_API
16 | {
17 | class AutoDataVector::AutoDataVectorImpl
18 | {
19 | public:
20 | std::shared_ptr _vector;
21 | };
22 |
23 | class AutoSupervisedDataset::AutoSupervisedDatasetImpl
24 | {
25 | public:
26 | ell::data::AutoSupervisedDataset _dataset;
27 | };
28 |
29 | } // namespace ELL_API
30 |
--------------------------------------------------------------------------------
/interfaces/common/include/MatrixMatrixMultiplyImplementation.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: MatrixMatrixMultiplyImplementation.h (interfaces)
5 | // Authors: Mason Remy
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | #include
11 |
12 | enum class MatrixMatrixMultiplyImplementation : int
13 | {
14 | SimpleForLoops = (int)ell::nodes::MatrixMatrixMultiplyImplementation::SimpleForLoops,
15 | Mlas_Loopnest_Value = (int)ell::nodes::MatrixMatrixMultiplyImplementation::Mlas_Loopnest_Value,
16 | ImplementationCount = (int)ell::nodes::MatrixMatrixMultiplyImplementation::LAST
17 | };
18 |
--------------------------------------------------------------------------------
/interfaces/common/math_javascript_post.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/math_javascript_pre.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/math_python_post.i:
--------------------------------------------------------------------------------
1 | CONSTRUCT_TENSOR_WITH_NUMPY(FloatTensor)
2 | CONSTRUCT_TENSOR_WITH_NUMPY(DoubleTensor)
3 |
--------------------------------------------------------------------------------
/interfaces/common/math_python_pre.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/model_javascript_post.i:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: model_javascript_post.i (interfaces)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 |
--------------------------------------------------------------------------------
/interfaces/common/noncopyable.i:
--------------------------------------------------------------------------------
1 | //
2 | // noncopyable.i -- wrapper macro to wrap an object with a move constructor but no copy constructor
3 | //
4 |
5 | %define wrap_noncopyable(type)
6 | %feature("novaluewrapper") type;
7 |
8 | %typemap(out) type
9 | %{
10 | #if SWIGPYTHON
11 | $result = SWIG_NewPointerObj(new $1_ltype(std::move($1)), $1_descriptor, SWIG_POINTER_OWN);
12 | #endif
13 | #if SWIGJAVASCRIPT
14 | $result = SWIG_NewPointerObj(new $1_ltype(std::move($1)), $1_descriptor, SWIG_POINTER_OWN);
15 | #endif
16 | #if SWIGCSHARP
17 | $result = new $1_ltype(std::move($1));
18 | #endif
19 | %};
20 | %enddef
21 |
--------------------------------------------------------------------------------
/interfaces/common/predictors_javascript_post.i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/interfaces/common/predictors_javascript_post.i
--------------------------------------------------------------------------------
/interfaces/common/predictors_javascript_pre.i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/interfaces/common/predictors_javascript_pre.i
--------------------------------------------------------------------------------
/interfaces/common/predictors_python_pre.i:
--------------------------------------------------------------------------------
1 | %ignore ell::predictors::neural::Layer::LayerParameters;
2 |
--------------------------------------------------------------------------------
/interfaces/common/shape.i:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: shape.i (common)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | // Include language specific SWIG definitions that must be declared before the
10 | // C++ code to be wrapped
11 |
12 | %inline %{
13 |
14 | namespace ell {
15 | namespace api {
16 | namespace math {
17 | typedef struct TensorShape
18 | {
19 | int rows;
20 | int columns;
21 | int channels;
22 | int Size() const { return rows * columns * channels; }
23 | } TensorShape;
24 | }
25 | }
26 | }
27 |
28 | %}
29 |
--------------------------------------------------------------------------------
/interfaces/common/trainers.i:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: trainers.i (interfaces)
5 | // Authors: Chuck Jacobs, Piali Choudhury, Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | %{
10 | #include "DatasetInterface.h"
11 | #include "TrainerInterface.h"
12 | %}
13 |
14 | %include "DatasetInterface.h"
15 | %include "TrainerInterface.h"
16 |
--------------------------------------------------------------------------------
/interfaces/common/vector_javascript_post.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/vector_javascript_pre.i:
--------------------------------------------------------------------------------
1 | // this file intentionally empty
--------------------------------------------------------------------------------
/interfaces/common/vector_python_post.i:
--------------------------------------------------------------------------------
1 |
2 | CONSTRUCT_VECTOR_WITH_NUMPY(FloatVector, np.float32)
3 | CONSTRUCT_VECTOR_WITH_NUMPY(DoubleVector, np.float)
4 | CONSTRUCT_VECTOR_WITH_NUMPY(IntVector, np.int32)
5 | CONSTRUCT_VECTOR_WITH_NUMPY(Int64Vector, np.int64)
6 | CONSTRUCT_VECTOR_WITH_NUMPY(Int8Vector, np.int8)
7 |
8 | TYPEMAP_VECTOR_TO_ARRAY(double)
9 | TYPEMAP_VECTOR_TO_ARRAY(float)
10 | TYPEMAP_VECTOR_TO_ARRAY(int)
11 | TYPEMAP_VECTOR_TO_ARRAY(int64_t)
12 | TYPEMAP_VECTOR_TO_ARRAY(int8_t)
13 |
--------------------------------------------------------------------------------
/interfaces/common/vector_python_pre.i:
--------------------------------------------------------------------------------
1 | %{
2 | #ifdef SWIGPYTHON
3 | #define SWIG_FILE_WITH_INIT
4 | #define SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
5 | #endif
6 | %}
7 |
--------------------------------------------------------------------------------
/interfaces/csharp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # SWIG csharp interfaces
3 | #
4 | include (CommonInterfaces)
5 |
6 | generate_interface(csharp ${CMAKE_CURRENT_SOURCE_DIR} "" "" "")
7 | add_dependencies(ELL_csharp ELL_common)
8 |
--------------------------------------------------------------------------------
/interfaces/javascript/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # SWIG javascript-on-node interfaces
3 | #
4 |
5 | include (CommonInterfaces)
6 |
7 | generate_interface(javascript ell ${CMAKE_CURRENT_SOURCE_DIR} "" "")
8 | add_dependencies(ELL_javascript ELL_common)
9 |
10 | add_subdirectory(ell_module)
11 | add_subdirectory(swigToTypescript)
12 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/copyWindowsTestLib.cmd:
--------------------------------------------------------------------------------
1 | mkdir .\dist\win\build\Test
2 |
3 | copy /Y build\Release\ell.node .\dist\win\build\Test
4 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/buildme:
--------------------------------------------------------------------------------
1 | # Build the ELL module
2 | node-gyp rebuild
3 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/buildme.cmd:
--------------------------------------------------------------------------------
1 | :: Build the ELL module
2 | @echo off
3 |
4 | Echo "%1"
5 | call npm install
6 |
7 | IF "%1"=="" (
8 | Echo building ELL for Electron
9 | REM call node-gyp rebuild
10 |
11 | call node-gyp rebuild --runtime=electron --target=1.7.9 --arch-x64 --dist-url=https://atom.io/download/atom-shell
12 | )
13 |
14 | IF /I "%1"=="node" (
15 | Echo building ELL for Node.JS
16 | call node-gyp rebuild
17 | )
18 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/copyLinuxLib.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir -p ./dist/linux/build/Release
4 |
5 | cp -f build/Release/ell.node ./dist/linux/build/Release
6 |
7 | echo "ELL revision: " > ./dist/linux/ELL_revision.txt
8 | git rev-parse HEAD >> ./dist/linux/ELL_revision.txt
9 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/copyMacLib.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir -p ./dist/mac/build/Release
4 |
5 | cp -f build/Release/ell.node ./dist/mac/build/Release
6 |
7 | echo "ELL revision: " > ./dist/mac/ELL_revision.txt
8 | git rev-parse HEAD >> ./dist/mac/ELL_revision.txt
9 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/copyWindowsLib.cmd:
--------------------------------------------------------------------------------
1 | set DIST=.\dist\win\build\Release
2 |
3 | if not exist %DIST% mkdir %DIST%
4 |
5 | copy /Y build\Release\ell.node %DIST%
6 |
7 | echo "ELL revision: " > .\dist\win\ELL_revision.txt
8 | git rev-parse HEAD > .\dist\win\ELL_revision.txt
9 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/ell_manual.d.ts:
--------------------------------------------------------------------------------
1 | import {CompiledMap} from 'ell'
2 |
3 |
4 | // template collections
5 | export class DoubleVector {
6 | size(): number;
7 | get(index: number): number;
8 | add(value: number);
9 | }
10 |
11 | export class DoubleVectorVector {
12 | size(): number;
13 | get(index: number): DoubleVector;
14 | add(vec: DoubleVector);
15 | }
16 |
17 | //
18 | // misc
19 | //
20 |
21 | export class LabeledPrototype {
22 | constructor(label: number, prototype: DoubleVectorVector);
23 | Label(): number;
24 | Dimension(): number;
25 | Prototype(): DoubleVectorVector;
26 | }
27 |
28 | export class PrototypeList {
29 | size(): number;
30 | get(index: number): LabeledPrototype;
31 | add(vec: LabeledPrototype);
32 | }
33 |
34 | export function GenerateDTWClassifier(prototype: DoubleVectorVector): CompiledMap;
35 | export function GenerateMulticlassDTWClassifier(prototype: PrototypeList): CompiledMap;
36 | export function GetDTWClassifierCode(prototype: DoubleVectorVector): string;
37 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/index.d.ts:
--------------------------------------------------------------------------------
1 | export * from "./ell"
2 | export * from "./ell_manual"
3 |
4 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/templates/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var ellLib = null;
4 |
5 | // darwin, freebas, linux, sunos, win32
6 |
7 | if(process.platform == 'win32') {
8 | ellLib = require('./dist/win/build/Release/ell')
9 | } else if (process.platform == 'darwin') {
10 | ellLib = require('./dist/mac/build/Release/ell')
11 | } else if (process.platform == 'linux') {
12 | ellLib = require('./dist/linux/build/Release/ell')
13 | }
14 |
15 | module.exports = ellLib;
16 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/test/js/GetDatasetAsync.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | let path = require('path');
4 | console.log(path.relative('.', __dirname));
5 |
6 | global.app_require = function(name) {
7 | return require(__dirname + '/' + name);
8 | }
9 |
10 | var tap = require('tap');
11 |
12 | console.log("#" + path.relative('.', __dirname));
13 |
14 | const ELL = require("ell");
15 |
16 | console.log("Loaded ELL");
17 | var dataset = ell.GetDataset("../data/testData.txt");
18 | console.log(dataset);
19 | if(dataset)
20 | {
21 | console.log("Sync Mode Size:" + dataset.NumExamples());
22 | tap.pass('Test GetDataset');
23 |
24 | var dataiter = dataset.GetIterator();
25 | console.log("Sync Itearator IsValid:" + dataiter.IsValid());
26 | console.log("Sync Itearator no. of iterations left:" + dataiter.NumIteratesLeft());
27 | }
28 |
29 | ell.GetDatasetAsync("../data/testData.txt", function(datasetasync)
30 | {
31 | if(datasetasync)
32 | {
33 | console.log("Async Mode Size:" + datasetasync.NumExamples());
34 | tap.pass('Test GetDatasetAsync');
35 | }
36 | });
37 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/test/js/LoadModelAsync.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | let path = require('path');
4 | console.log(path.relative('.', __dirname));
5 |
6 | global.app_require = function(name) {
7 | return require(__dirname + '/' + name);
8 | }
9 |
10 | var tap = require('tap');
11 |
12 | console.log("#" + path.relative('.', __dirname));
13 |
14 | const ELL = require("ell");
15 |
16 |
17 | console.log("Loaded ELL");
18 | var modelsync = ell.LoadModel("[1]");
19 | if(modelsync)
20 | {
21 | console.log("Sync Mode Size:" + modelsync.Size());
22 | tap.pass('Test LoadModel syncronously');
23 | }
24 |
25 | ell.LoadModelAsync("[1]" ,function(model)
26 | {
27 | if(model)
28 | {
29 | console.log("ASync Mode Size:" + model.Size());
30 | tap.pass('Test LoadModelAsync asyncronously');
31 | }
32 | });
33 |
--------------------------------------------------------------------------------
/interfaces/javascript/ell_module/test/js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ell_tests",
3 | "version": "0.0.1",
4 | "description": "Suite of tests for ELL Core",
5 | "main": "LoadModelAsync.js",
6 | "devDependencies": {
7 | "tap": "^6.2.0"
8 | },
9 | "dependencies": {
10 | "requirejs": "^2.2.0",
11 | "nan": "^2.4.0",
12 | "ell": "file:../../ell_module"
13 | },
14 | "scripts": {
15 | "test": "tap *.js"
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/interfaces/javascript/swigToTypescript/templates/index.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | var libxslt = require('libxslt');
3 |
4 | var xsltFilename = process.argv[2];
5 | var documentFilename = process.argv[3];
6 | var outputFilename = process.argv[4];
7 |
8 | libxslt.parseFile(xsltFilename, function (err, stylesheet) {
9 | if (err) {
10 | console.log("Error during XSLT parsing:");
11 | console.log(err);
12 | return;
13 | }
14 |
15 | stylesheet.applyToFile(documentFilename, function (err, result) {
16 | // err contains any error from parsing the document or applying the stylesheet
17 | // result is a string containing the result of the transformation
18 | fs.writeFile(outputFilename, result);
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/interfaces/javascript/swigToTypescript/templates/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "swig-to-typescript",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "run": "node index.js",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "author": "",
11 | "license": "MIT",
12 | "devDependencies": {
13 | "libxslt": "^0.6.3"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/interfaces/python/package/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage")
4 |
5 | set(src bld.bat build.sh MANIFEST.in meta.yaml setup.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${src})
8 |
9 | copy_newer_files(${module_name} src)
10 |
11 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package")
12 |
13 | add_subdirectory(ell)
14 | add_dependencies(${module_name} ${module_name}_ell)
15 |
16 | endif() # PYTHON_ENABLED
17 |
--------------------------------------------------------------------------------
/interfaces/python/package/MANIFEST.in:
--------------------------------------------------------------------------------
1 | recursive-include ell/Release *
2 | recursive-include ell/deploy *
3 | recursive-include ell/headers *
4 | include ell/*.so
5 | include ell/*.so.*
6 |
--------------------------------------------------------------------------------
/interfaces/python/package/bld.bat:
--------------------------------------------------------------------------------
1 | "%PYTHON%" setup.py install
2 | if errorlevel 1 exit 1
3 |
--------------------------------------------------------------------------------
/interfaces/python/package/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | $PYTHON setup.py install
4 |
--------------------------------------------------------------------------------
/interfaces/python/package/ell/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell")
4 |
5 | set(src __init__.py rpi_magic.py platform.py)
6 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${src})
7 |
8 | set(module_components
9 | data
10 | math
11 | model
12 | neural
13 | nodes
14 | trainers
15 | util
16 | vision
17 | )
18 |
19 | foreach(component ${module_components})
20 | add_subdirectory(${component})
21 | add_dependencies(${module_name} ${module_name}_${component})
22 | endforeach(component ${module_components})
23 |
24 | copy_newer_files(${module_name} src)
25 |
26 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell")
27 |
28 | endif() # PYTHON_ENABLED
29 |
--------------------------------------------------------------------------------
/interfaces/python/package/ell/data/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_data")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/data")
12 |
13 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/data/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft. All rights reserved.
2 | # Licensed under the MIT license. See LICENSE.md file in the project root
3 | # for full license information.
4 | # ==============================================================================
5 | """
6 | ELL data classes
7 | """
8 |
9 | from ..ell_py import AutoDataVector, \
10 | AutoSupervisedDataset, \
11 | AutoSupervisedExample, \
12 | StringVector
--------------------------------------------------------------------------------
/interfaces/python/package/ell/math/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_math")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/math")
12 |
13 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/math/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft. All rights reserved.
2 | # Licensed under the MIT license. See LICENSE.md file in the project root
3 | # for full license information.
4 | # ==============================================================================
5 | """
6 | ELL math classes
7 | """
8 |
9 | from ..ell_py import DoubleArgmax, \
10 | DoubleTensor, \
11 | DoubleVector, \
12 | DoubleVectorVector, \
13 | DoubleCallbackBase, \
14 | FloatArgmax, \
15 | FloatTensor, \
16 | FloatVector, \
17 | FloatVectorVector, \
18 | FloatCallbackBase, \
19 | HingeLoss, \
20 | IntCallbackBase, \
21 | Int8CallbackBase, \
22 | IntVector, \
23 | Int64Vector, \
24 | Int8Vector, \
25 | LogLoss, \
26 | SquaredLoss, \
27 | TensorShape
28 |
--------------------------------------------------------------------------------
/interfaces/python/package/ell/model/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_model")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/model")
12 |
13 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/model/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft. All rights reserved.
2 | # Licensed under the MIT license. See LICENSE.md file in the project root
3 | # for full license information.
4 | # ==============================================================================
5 | """
6 | ELL model classes
7 | """
8 |
9 | from ..ell_py import \
10 | CompiledMap,\
11 | Map,\
12 | MapCompilerOptions,\
13 | Model,\
14 | ModelBuilder,\
15 | ModelOptimizerOptions,\
16 | PortMemoryLayout
17 |
18 |
19 | # Provide correct behavior of != and == on PortMemoryLayouts.
20 | PortMemoryLayout.__eq__ = PortMemoryLayout.IsEqual
21 |
22 | def PortMemoryLayoutNotEqual(a,b):
23 | return not a.IsEqual(b)
24 |
25 | PortMemoryLayout.__ne__ = PortMemoryLayoutNotEqual
26 |
27 | del PortMemoryLayoutNotEqual
28 |
29 | def PortMemoryLayoutToString(m):
30 | return "size: {}, extent: {}, offset: {}, order: {}".format(list(m.size), list(m.extent), list(m.offset), list(m.order))
31 |
32 | PortMemoryLayout.ToString = PortMemoryLayoutToString
33 |
34 | del PortMemoryLayoutToString
--------------------------------------------------------------------------------
/interfaces/python/package/ell/neural/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_neural")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/neural")
12 |
13 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/nodes/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_nodes")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/nodes")
12 |
13 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/nodes/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft. All rights reserved.
2 | # Licensed under the MIT license. See LICENSE.md file in the project root
3 | # for full license information.
4 | # ==============================================================================
5 | """
6 | ELL nodes
7 | """
8 |
9 | from ..ell_py import BinaryOperationType,\
10 | InputNode,\
11 | InputNodeList,\
12 | InputPort,\
13 | InputPortIterator, \
14 | MatrixMatrixMultiplyImplementation, \
15 | Node,\
16 | NodeIterator,\
17 | OutputNode,\
18 | OutputNodeList,\
19 | OutputPort,\
20 | OutputPortIterator,\
21 | Port,\
22 | PortElement,\
23 | PortElements,\
24 | PortElementsList,\
25 | PortType,\
26 | UnaryOperationType
27 |
28 |
29 | def IteratorHelper(iter):
30 | while iter.IsValid():
31 | yield iter.Get()
32 | iter.Next()
33 |
34 | NodeIterator.__iter__ = IteratorHelper
35 | InputPortIterator.__iter__ = IteratorHelper
36 | OutputPortIterator.__iter__ = IteratorHelper
37 |
38 | del IteratorHelper
--------------------------------------------------------------------------------
/interfaces/python/package/ell/platform.py:
--------------------------------------------------------------------------------
1 | """The various platforms to which ELL models can be compiled"""
2 |
3 | MAC = 'mac'
4 | LINUX = 'linux'
5 | WINDOWS = 'windows'
6 | PI0 = 'pi0'
7 | PI3 = 'pi3'
8 | PI3_64 = 'pi3_64'
9 | AARCH64 = 'aarch64'
10 | IOS = 'ios'
11 |
12 | # special global to record the fact we are running inside Jupyter Notebook.
13 | has_magic = False
--------------------------------------------------------------------------------
/interfaces/python/package/ell/trainers/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_trainers")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/trainers")
12 |
13 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/trainers/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft. All rights reserved.
2 | # Licensed under the MIT license. See LICENSE.md file in the project root
3 | # for full license information.
4 | # ==============================================================================
5 | """
6 | ELL trainers
7 | """
8 |
9 | from ..ell_py import ProtoNNLossFunction, \
10 | ProtoNNPredictor, \
11 | ProtoNNTrainer, \
12 | ProtoNNTrainerParameters
--------------------------------------------------------------------------------
/interfaces/python/package/ell/util/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_util")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | set (other_files ${PROJECT_SOURCE_DIR}/tools/utilities/pythonlibs/download_helper.py
12 | ${PROJECT_SOURCE_DIR}/tools/utilities/pythonlibs/logger.py
13 | ${PROJECT_SOURCE_DIR}/tools/utilities/pythonlibs/find_ell.py)
14 |
15 |
16 | copy_newer_files(${module_name} other_files)
17 |
18 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/util")
19 |
20 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/util/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft. All rights reserved.
2 | # Licensed under the MIT license. See LICENSE.md file in the project root
3 | # for full license information.
4 | # ==============================================================================
5 |
6 | from . import gallery
7 | from . import choose_subset
8 | from . import condabuildtools
--------------------------------------------------------------------------------
/interfaces/python/package/ell/vision/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(${PYTHON_ENABLED})
2 |
3 | set(module_name "pythonpackage_ell_vision")
4 |
5 | file(GLOB PYFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
6 |
7 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${PYFILES})
8 |
9 | copy_newer_files(${module_name} PYFILES)
10 |
11 | # Put some useful files from the utilities directory into our package
12 | set(other_files ${PROJECT_SOURCE_DIR}/tools/importers/CNTK/cntk_to_ell.py
13 | ${PROJECT_SOURCE_DIR}/tools/importers/darknet/darknet_to_ell.py
14 | ${PROJECT_SOURCE_DIR}/tools/utilities/pythonlibs/vision/demoHelper.py)
15 |
16 | copy_newer_files(${module_name} other_files)
17 |
18 | set_property(TARGET ${module_name} PROPERTY FOLDER "interfaces/python/package/ell/vision")
19 |
20 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/interfaces/python/package/ell/vision/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft. All rights reserved.
2 | # Licensed under the MIT license. See LICENSE.md file in the project root
3 | # for full license information.
4 | # ==============================================================================
5 |
--------------------------------------------------------------------------------
/interfaces/python/package/meta.yaml:
--------------------------------------------------------------------------------
1 | package:
2 | name: ell
3 | version: !!str 0.0.1
4 |
5 | source:
6 | path: .
7 |
8 | requirements:
9 | build:
10 | - python
11 | run:
12 | - python
13 | - numpy
14 | - requests
15 | - paramiko
16 | - llvmdev >=6.0,<7.0
17 | - swig ==4.0.0
18 | - opencv
19 | - github
20 |
21 | about:
22 | home: https://github.com/Microsoft/ELL
23 | license: MIT License
24 |
--------------------------------------------------------------------------------
/interfaces/python/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${PYTHON_ENABLED})
6 | set(test_name ell-python-interface-test)
7 |
8 | file(GLOB test_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
9 |
10 | add_custom_target(${test_name} ALL DEPENDS ${test_src} SOURCES ${test_src})
11 | add_dependencies(${test_name} pythonlibs dspDataFiles _ELL_python)
12 | set_property(TARGET ${test_name} PROPERTY FOLDER "tests")
13 |
14 | # copy the contents of the test directory to build/interfaces/python
15 | copy_newer_files(${test_name} test_src)
16 |
17 | # add the python test to the cmake suite of tests
18 | add_test(NAME ${test_name}
19 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
20 | COMMAND ${PYTHON_EXECUTABLE} test.py)
21 | set_property(TARGET ${test_name} PROPERTY FOLDER "tests")
22 |
23 | endif() # PYTHON_ENABLED
24 |
--------------------------------------------------------------------------------
/interfaces/python/test/common_test.py:
--------------------------------------------------------------------------------
1 | import ell_helper
2 | import ell
3 | import os
4 |
5 | def TestLoadSaveModel(fileName):
6 | print("Loading file %s" % fileName)
7 | m = ell.model.Model(fileName)
8 |
9 | # save file in build folder to ensure we don't cause git changes
10 | fname = os.path.basename(fileName)
11 | path = os.path.abspath(fname)
12 | print("saving model in '%s'" % (path))
13 | m.Save(path)
14 |
15 | def TestLoadSaveModels():
16 | prefix = "../../../examples/models/"
17 | fileNames = ["model_1.model", "model_2.model"]
18 | for fileName in fileNames:
19 | TestLoadSaveModel(prefix + fileName)
20 |
21 |
22 | def test():
23 | try:
24 | TestLoadSaveModels()
25 | return 0
26 | except:
27 | return 1
28 |
29 |
30 | if __name__ == "__main__":
31 | rc = test()
32 | if rc:
33 | print("### Test failed")
34 |
35 |
36 |
--------------------------------------------------------------------------------
/interfaces/python/test/ell_helper.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | script_path = os.path.dirname(os.path.abspath(__file__))
4 | sys.path += [os.path.join(script_path, '..', '..', '..', 'tools', 'utilities', 'pythonlibs')]
5 | import find_ell
--------------------------------------------------------------------------------
/interfaces/python/test/evaluators_test.py:
--------------------------------------------------------------------------------
1 | import ell_helper
2 | import ell
3 |
4 | def test():
5 | print("evaluators_test.test -- TBD")
6 | return 0
7 |
--------------------------------------------------------------------------------
/interfaces/python/test/linear_test.py:
--------------------------------------------------------------------------------
1 | import ell_helper
2 | import ell
3 |
4 | def test():
5 | print("linear_test.test -- TBD")
6 | return 0
7 |
--------------------------------------------------------------------------------
/interfaces/python/test/modelbuilder_test.py:
--------------------------------------------------------------------------------
1 | import ell_helper
2 | import ell
3 | from testing import Testing
4 |
5 | def makeStringVec(strings):
6 | v = ell.data.StringVector()
7 | for s in strings:
8 | v.push_back(s)
9 | return v
10 |
11 | def testModelBuilder(testing):
12 | model = ell.model.Model()
13 | mb = ell.model.ModelBuilder()
14 | inArgs = makeStringVec(["3"])
15 | inputNode = mb.AddNode(model, "InputNode", inArgs)
16 | outArgs = makeStringVec([inputNode.GetId()+".output"])
17 | mb.AddNode(model, "OutputNode", outArgs)
18 | testing.ProcessTest("Testing ModelBuilder", testing.IsEqual(model.Size(), 2))
19 |
20 | def test():
21 | testing = Testing()
22 | testModelBuilder(testing)
23 | return testing.GetFailedTests()
24 |
25 | if __name__ == '__main__':
26 | rc = test()
27 | if rc:
28 | print("### Test failed: {}", rc)
29 |
--------------------------------------------------------------------------------
/interfaces/python/test/protonnTestData.bc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/interfaces/python/test/protonnTestData.bc
--------------------------------------------------------------------------------
/interfaces/python/test/sgd_trainer_test.py:
--------------------------------------------------------------------------------
1 | import ell_helper
2 | import ell
3 |
4 | def test():
5 | params = ell.SGDIncrementalTrainerParameters()
6 | params.regularization = 0.01
7 | loss = ell.LossArguments()
8 |
9 | trainer = ell.GetSGDIncrementalTrainer(21, loss, params)
10 | print(type(trainer))
11 |
12 | dataset = ell.GetDataset("../../../../examples/data/testData.txt")
13 | print(type(dataset))
14 |
15 | ex = dataset.GetExample(0)
16 | print(type(ex))
17 |
18 | iterator = dataset.GetIterator(0, dataset.NumExamples())
19 | print(type(iterator))
20 |
21 | try:
22 | trainer.Update(iterator)
23 | print("trainer.Update(...) succeeded")
24 | except msg as TypeError:
25 | print("trainer.Update(...) threw a TypeError exception", msg)
26 | return ["SGDIncrementalTrainer"]
27 |
28 | return []
29 |
--------------------------------------------------------------------------------
/interfaces/python/test/trainers_test.py:
--------------------------------------------------------------------------------
1 | import ell_helper
2 | import ell
3 |
4 | def test():
5 | print("trainers_test.test -- TBD")
6 | return 0
7 |
--------------------------------------------------------------------------------
/interfaces/xml/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # SWIG csharp interfaces
3 | #
4 | include (CommonInterfaces)
5 |
6 | generate_interface(xml ell ${CMAKE_CURRENT_SOURCE_DIR} "" "" "")
7 | add_dependencies(ELL_xml ELL_common)
8 |
--------------------------------------------------------------------------------
/libraries/common/include/RegisterNodeCreators.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: RegisterNodeCreators.h (common)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | namespace common
16 | {
17 | /// Registers node-creation functions with the ModelBuilder class
18 | void RegisterNodeCreators(model::ModelBuilder& builder);
19 | } // namespace common
20 | } // namespace ell
21 |
--------------------------------------------------------------------------------
/libraries/common/src/EvaluatorArguments.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: EvaluatorArguments.cpp (common)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "EvaluatorArguments.h"
10 |
11 | namespace ell
12 | {
13 | namespace common
14 | {
15 | void ParsedEvaluatorArguments::AddArgs(utilities::CommandLineParser& parser)
16 | {
17 | parser.AddOption(
18 | evaluationFrequency,
19 | "evaluationFrequency",
20 | "ef",
21 | "Frequency of evaluation, a value of k>0 means evaluate every k iterations",
22 | 1);
23 |
24 | parser.AddOption(
25 | addZeroEvaluation,
26 | "addZeroEvaluation",
27 | "aze",
28 | "Add an evaluation using the constant zero predictor",
29 | true);
30 | }
31 | } // namespace common
32 | } // namespace ell
33 |
--------------------------------------------------------------------------------
/libraries/common/test/include/LoadDataset_test.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 | // LoadModel tests
4 | //
5 |
6 | #include
7 |
8 | namespace ell
9 | {
10 | void TestLoadDataset(const std::string& examplePath);
11 | void TestLoadMappedDataset(const std::string& examplePath);
12 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/common/test/include/LoadMap_test.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 | // LoadMap tests
4 | //
5 | #include
6 |
7 | namespace ell
8 | {
9 | void TestLoadMapWithDefaultArgs(const std::string& examplePath);
10 | void TestLoadMapWithPorts(const std::string& examplePath);
11 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/common/test/include/LoadModel_test.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | //
3 | // LoadModel tests
4 | //
5 |
6 | #include
7 |
8 | namespace ell
9 | {
10 | void TestLoadSampleModels();
11 | void TestLoadTreeModels();
12 | void TestLoadSavedModels(const std::string& examplePath);
13 | void TestSaveModels();
14 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/common/test/include/LoadTestModels.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: LoadTestModels.h (common)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | #include
17 |
18 | namespace ell
19 | {
20 | namespace common
21 | {
22 | /// Loads a named test model.
23 | ///
24 | /// The name of built in test model.
25 | /// The loaded test model.
26 | model::Model LoadTestModel(const std::string& name);
27 | } // namespace common
28 | } // namespace ell
29 |
--------------------------------------------------------------------------------
/libraries/data/src/DataVector.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DataVector.cpp (data)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "DataVector.h"
10 |
11 | namespace ell
12 | {
13 | namespace data
14 | {
15 | void operator+=(math::RowVectorReference vector, const IDataVector& dataVector)
16 | {
17 | dataVector.AddTo(vector);
18 | }
19 | } // namespace data
20 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/data/src/DataVectorOperations.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DataVectorOperations.cpp (data)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "DataVectorOperations.h"
10 |
11 | namespace ell
12 | {
13 | namespace data
14 | {
15 |
16 | double operator*(const IDataVector& dataVector, math::UnorientedConstVectorBase vector)
17 | {
18 | return vector * dataVector;
19 | }
20 | } // namespace data
21 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/data/src/Dataset.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Dataset.cpp (data)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "Dataset.h"
10 |
11 | namespace ell
12 | {
13 | namespace data
14 | {
15 | AnyDataset::AnyDataset(const DatasetBase* pDataset, size_t fromIndex, size_t size) :
16 | _pDataset(pDataset),
17 | _fromIndex(fromIndex),
18 | _size(size)
19 | {
20 | }
21 | } // namespace data
22 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/data/test/include/DataVector_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DataVector_test.h (data_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void IDataVectorTests();
14 | void DataVectorCopyAsTests();
15 | void AutoDataVectorTest();
16 | void TransformedDataVectorTest();
17 | void IteratorTests();
18 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/data/test/include/Dataset_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Dataset_test.h (data_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void DatasetCastingTests();
14 | void DatasetSerializationTests();
15 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/data/test/include/Example_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Example_test.h (data_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void ExampleCopyAsTests();
14 | }
--------------------------------------------------------------------------------
/libraries/data/test/include/Parser_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Parser_test.h (data_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | namespace ell
11 | {
12 | void DataVectorParseTest();
13 | void AutoDataVectorParseTest();
14 | void SingleFileParseTest();
15 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/data/test/src/main.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: main.cpp (dataset_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "DataVector_test.h"
10 | #include "Dataset_test.h"
11 | #include "Example_test.h"
12 | #include "Parser_test.h"
13 |
14 | #include
15 |
16 | using namespace ell;
17 |
18 | /// Runs all tests
19 | ///
20 | int main()
21 | {
22 | IDataVectorTests();
23 | DataVectorCopyAsTests();
24 | AutoDataVectorTest();
25 | TransformedDataVectorTest();
26 | IteratorTests();
27 | ExampleCopyAsTests();
28 | DatasetCastingTests();
29 | DatasetSerializationTests();
30 | DataVectorParseTest();
31 | AutoDataVectorParseTest();
32 | SingleFileParseTest();
33 |
34 | if (testing::DidTestFail())
35 | {
36 | return 1;
37 | }
38 |
39 | return 0;
40 | }
41 |
--------------------------------------------------------------------------------
/libraries/dsp/test/include/CepstrumTestData.h:
--------------------------------------------------------------------------------
1 |
2 | ////////////////////////////////////////////////////////////////////////////////////////////////////
3 | //
4 | // Project: Embedded Learning Library (ELL)
5 | // File: CepstrumTestData.h (dsp)
6 | // Authors: Chuck Jacobs
7 | //
8 | ////////////////////////////////////////////////////////////////////////////////////////////////////
9 |
10 | #pragma once
11 |
12 | #include
13 |
14 | std::vector> GetReferenceCepstrumCoefficients();
15 |
--------------------------------------------------------------------------------
/libraries/dsp/test/include/ConvolutionTiming.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ConvolutionTiming.h (dsp)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | // 1D convolution over a vector
14 | template
15 | void TimeConv1D(size_t signalSize, size_t filterSize, size_t numIterations, ell::dsp::ConvolutionMethodOption algorithm);
16 |
17 | // 2D convolution over a tensor
18 | template
19 | void TimeConv2D(size_t numRows, size_t numColumns, size_t numChannels, size_t filterSize, size_t numFilters, size_t numIterations, ell::dsp::ConvolutionMethodOption algorithm);
20 |
--------------------------------------------------------------------------------
/libraries/dsp/test/include/DCTTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DCTTest.h (dsp)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestDCT();
12 |
--------------------------------------------------------------------------------
/libraries/dsp/test/include/FFTTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: FFTTest.h (dsp)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | template
14 | void TestFFT(size_t N);
15 |
16 | template
17 | void VerifyFFT();
18 |
--------------------------------------------------------------------------------
/libraries/dsp/test/include/FilterTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: FilterTest.h (dsp)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | template
12 | void TestIIRFilter();
13 |
14 | template
15 | void TestIIRFilterMultiSample();
16 |
17 | template
18 | void TestIIRFilterImpulse();
19 |
--------------------------------------------------------------------------------
/libraries/dsp/test/include/MelTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: MelTest.h (dsp)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestMelFilterBank();
12 | void TestMelFilterBank2();
13 |
--------------------------------------------------------------------------------
/libraries/dsp/test/include/WindowTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: WindowTest.h (dsp)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | template
12 | void TestHammingWindow();
13 |
14 | template
15 | void TestHammingWindow2();
16 |
17 | template
18 | void TestHannWindow();
19 |
--------------------------------------------------------------------------------
/libraries/emittable_functions/include/Convolutions.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Convolutions.h (emittable_functions)
5 | // Authors: Byron Changuion
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | namespace emittable_functions
16 | {
17 |
18 | void SimpleConvolve1D(value::Vector signal, value::Vector filter, value::Vector output);
19 |
20 | void SimpleDepthwiseSeparableConvolve2D(value::Tensor signal, value::Tensor filter, value::Scalar rowStride,
21 | value::Scalar columnStride, value::Tensor output);
22 | } // namespace emittable_functions
23 | } // namespace ell
24 |
--------------------------------------------------------------------------------
/libraries/emittable_functions/include/IIRFilter.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: IIRFilter.h (emittable_functions)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | namespace emittable_functions
16 | {
17 |
18 | struct IIRFilterCoefficients
19 | {
20 | value::Vector b; // feedforward coeffs
21 | value::Vector a; // feedback coeffs
22 | };
23 |
24 | value::Vector FilterSamples(value::Vector signal, IIRFilterCoefficients filterCoeffs);
25 |
26 | } // namespace emittable_functions
27 | } // namespace ell
28 |
--------------------------------------------------------------------------------
/libraries/emittable_functions/include/LogisticFunctions.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: LogisticFunctions.h (emittable_functions)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | namespace emittable_functions
16 | {
17 | /// Apply the softmax function to the given input
18 | ///
19 | /// The input vector remains unchanged.
20 | /// The output vector to write result to.
21 | void Softmax(value::Vector input, value::Vector output);
22 |
23 | value::Scalar Sigmoid(value::Scalar s);
24 |
25 | value::Scalar HardSigmoid(value::Scalar s);
26 |
27 | value::Scalar HardTanh(value::Scalar s);
28 |
29 |
30 | } // namespace emittable_functions
31 | } // namespace ell
32 |
--------------------------------------------------------------------------------
/libraries/emittable_functions/test/include/Convolutions_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Convolutions_test.h (emittable_functions)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | #include
14 | #include
15 |
16 | namespace ell
17 | {
18 |
19 | void test_simpleDepthwiseSeparableConvolve2D();
20 |
21 | } // namespace ell
22 |
--------------------------------------------------------------------------------
/libraries/emittable_functions/test/include/IIRFilter_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: IIRFilterValue_test.h (emittable_functions)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | #include
14 | #include
15 |
16 | namespace ell
17 | {
18 | void TestIIRFilter();
19 |
20 | void TestIIRFilter(std::vector signal, std::vector b, std::vector a, std::vector expected);
21 | } // namespace ell
22 |
--------------------------------------------------------------------------------
/libraries/emittable_functions/test/include/LogisticFunctionsTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: LogisticFunctionsTest.h (emittable_functions)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | #include
14 | #include
15 |
16 | namespace ell
17 | {
18 |
19 | void TestSoftmax();
20 | void TestSigmoid();
21 | void TestHardSigmoid();
22 |
23 | } // namespace ell
24 |
--------------------------------------------------------------------------------
/libraries/emittable_functions/test/include/VoiceActivityDetectorTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: VoiceActivityDetectorTest.h (dsp)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 |
16 | template
17 | void TestVoiceActivityDetector(const std::string& path);
18 |
19 | } // namespace ell
20 |
--------------------------------------------------------------------------------
/libraries/emitters/include/IRSwigInterfaceWriter.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: IRSwigInterfaceWriter.h (emitters)
5 | // Authors: Lisa Ong
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | #include "IRModuleEmitter.h"
11 |
12 | #include
13 |
14 | namespace ell
15 | {
16 | namespace emitters
17 | {
18 | /// Write a C++ SWIG interface file for the given module.
19 | ///
20 | /// The output stream to write to.
21 | /// The `IRModuleEmitter` containing the module to write
22 | /// The name of the SWIG header file
23 | void WriteModuleSwigInterface(std::ostream& os, IRModuleEmitter& moduleEmitter, const std::string& headerName);
24 | } // namespace emitters
25 | } // namespace ell
26 |
--------------------------------------------------------------------------------
/libraries/emitters/templates/LLVMEmitterTargets.h.in:
--------------------------------------------------------------------------------
1 | // Auto-generated
2 | // The contents of this file are based on the CMake variable LLVM_EMITTER_TARGETS
3 | // Specified in libraries/emitters/CMakeLists.txt
4 | // The generated preprocessor define is part of an X-Macro (https://en.wikipedia.org/wiki/X_Macro)
5 | // The other part of the X-Macro relies on the definition of the macro EMITTER_TARGET_ACTION(TargetName)
6 |
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Project: Embedded Learning Library (ELL)
10 | // File: LLVMEmitterTargets.h (emitters)
11 | // Authors: Kern Handa
12 | //
13 | ////////////////////////////////////////////////////////////////////////////////////////////////////
14 |
15 | #define LLVM_EMITTER_TARGETS \
16 | @emitter_targets_content@
17 |
--------------------------------------------------------------------------------
/libraries/emitters/templates/SwigModule.in:
--------------------------------------------------------------------------------
1 | u8R"(%module(directors="1", moduleimport="import $module") @@MODULE@@
2 | %feature("autodoc", "3");
3 |
4 | %include "stdint.i"
5 |
6 | %include "vector.i"
7 |
8 | // Propagate python callback exceptions
9 | %feature("director:except") {
10 | if ($error != NULL) {
11 | PyObject* ptype = nullptr;
12 | PyObject* pvalue = nullptr;
13 | PyObject* ptraceback = nullptr;
14 | PyErr_Fetch(&ptype, &pvalue, &ptraceback);
15 | PyErr_Restore(ptype, pvalue, ptraceback);
16 | PyErr_Print();
17 | Py_Exit(1);
18 | }
19 | }
20 |
21 | %{
22 | #include "@@HEADER@@"
23 | %}
24 |
25 | %feature("director") @@CLASSNAME@@;
26 |
27 | )"
28 |
--------------------------------------------------------------------------------
/libraries/emitters/templates/SwigPredictPython.in:
--------------------------------------------------------------------------------
1 | u8R"(
2 |
3 | _model_wrapper = None
4 |
5 | def predict(inputData: 'numpy.ndarray') -> "numpy.ndarray":
6 | """Convenience function for calling the model directly without callbacks"""
7 | global _model_wrapper
8 | if _model_wrapper is None:
9 | _model_wrapper = @@WRAPPER_CLASS@@()
10 |
11 | if _model_wrapper.IsSteppable():
12 | raise Exception("You need to use the @@WRAPPER_CLASS@@ directly because this model is steppable, which means the input is provided by a callback method")
13 |
14 | inputVector = @@INPUT_VECTOR_TYPE@@(inputData)
15 | output = _model_wrapper.@@PREDICT_METHOD@@(inputVector)
16 | return np.array(output)
17 |
18 | def reset():
19 | @@RESET_FUNCTION@@()
20 |
21 | )"
--------------------------------------------------------------------------------
/libraries/emitters/templates/SwigShapeWrappers.in:
--------------------------------------------------------------------------------
1 | u8R"(
2 | %inline %{
3 | TensorShape get_default_input_shape() {
4 | TensorShape s;
5 | @@MODULE@@_GetInputShape(0, &s);
6 | return s;
7 | }
8 | TensorShape get_default_output_shape() {
9 | TensorShape s;
10 | @@MODULE@@_GetOutputShape(0, &s);
11 | return s;
12 | }
13 | %}
14 |
15 | %pythoncode %{
16 |
17 | def TensorShape_Size(self):
18 | return self.rows * self.columns * self.channels
19 |
20 | TensorShape.Size = TensorShape_Size
21 |
22 | %}
23 | )"
--------------------------------------------------------------------------------
/libraries/emitters/test/include/AsyncEmitterTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: AsyncEmitterTest.h (emitters_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestIRAsyncTask(bool parallel);
11 |
12 | void TestParallelTasks(bool parallel, bool useThreadPool);
13 |
14 | void TestParallelFor(int start, int end, int increment, bool parallel);
15 |
--------------------------------------------------------------------------------
/libraries/emitters/test/include/IRFunctionTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: IRFunctionTest.h (emitters_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestIRAddFunction();
11 | void TestCompilableFunction();
12 | void TestStringCompareFunction();
13 | void TestAllocaPlacement();
14 |
--------------------------------------------------------------------------------
/libraries/emitters/test/include/IRProfilerTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: IRProfilerTest.h (emitters_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestProfileRegion();
11 |
--------------------------------------------------------------------------------
/libraries/emitters/test/include/PosixEmitterTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: PosixEmitterTest.h (emitters_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestPthreadSelf();
11 | void TestPthreadCreate();
12 |
--------------------------------------------------------------------------------
/libraries/emitters/test/include/StdlibEmitterTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: StdlibEmitterTest.h (emitters_test)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestIRMallocFunction();
11 |
--------------------------------------------------------------------------------
/libraries/evaluators/test/include/Evaluators_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Evaluators_test.h (evaluators_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | namespace ell
11 | {
12 | void TestEvaluators();
13 | }
--------------------------------------------------------------------------------
/libraries/evaluators/test/src/main.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: main.cpp (evaluators_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | /// Runs all tests
10 | ///
11 |
12 | #include "Evaluators_test.h"
13 |
14 | #include
15 |
16 | #include
17 |
18 | #include
19 |
20 | using namespace ell;
21 |
22 | int main()
23 | {
24 | try
25 | {
26 | TestEvaluators();
27 | }
28 | catch (const utilities::Exception& exception)
29 | {
30 | std::cerr << "ERROR, got ELL exception. Message: " << exception.GetMessage() << std::endl;
31 | throw;
32 | }
33 |
34 | if (testing::DidTestFail())
35 | {
36 | return 1;
37 | }
38 | return 0;
39 | }
40 |
--------------------------------------------------------------------------------
/libraries/math/include/Common.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Common.h (math)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | namespace math
14 | {
15 | /// An enum that represent different implementation types.
16 | enum class ImplementationType
17 | {
18 | native,
19 | openBlas
20 | };
21 |
22 | /// A stub class that represents the scalar one.
23 | struct One
24 | {};
25 | } // namespace math
26 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/math/include/MathConstants.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: MathConstants.h (math)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | namespace math
14 | {
15 | /// A struct that holds various mathematical constants.
16 | template
17 | struct Constants
18 | {
19 | constexpr static const ValueType pi = static_cast(3.14159265358979323846);
20 | };
21 | } // namespace math
22 | } // namespace ell
23 |
--------------------------------------------------------------------------------
/libraries/model/doc/CompileAsFunction.md:
--------------------------------------------------------------------------------
1 | # Compiling nodes as functions
2 |
3 | Function signature:
4 | ```
5 | void f(in1, in2, , out1, out2);
6 | ```
7 |
8 | Emitting code for example function f(x) -> x^2
9 |
10 | Normal (inline):
11 | ```
12 | Compile()
13 | {
14 | auto x = InputPort.Load();
15 | auto x2 = mul(x,x);
16 | auto out = OutputPort.GetVar();
17 | out.Set(x2);
18 | }
19 | ```
20 |
21 | As function:
22 |
23 | ```
24 | Compile()
25 | {
26 | if(!function defined)
27 | {
28 | emitter.Define f(double[] input, double[] output)
29 | {
30 | auto x = in.Load(); // (?)
31 | auto x2 = mul(x,x);
32 | output.Set(x2);
33 | }
34 | }
35 |
36 | emitter.Call(f, InputPort, OutputPort);
37 |
38 | }
39 | ```
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/CostModelTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: CostModelTest.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // CostModel class tests
13 | //
14 |
15 | void TestExampleCostModels();
16 |
17 | void TestSimpleCostModel();
18 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/CostTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: CostTest.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // Cost class tests
13 | //
14 | void TestCosts();
15 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/EnvironmentTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: EnvironmentTest.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // Environment class tests
13 | //
14 | void TestEnvironment();
15 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/ExampleObjectives.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ExampleObjectives.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include "Cost.h"
12 | #include "Objective.h"
13 |
14 | class SimpleObjective : public ell::model::optimizer::Objective
15 | {
16 | public:
17 | double Evaluate(const ell::model::optimizer::Cost& cost) const override;
18 | };
19 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/Objective.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Objective.h (model/optimizer)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include "Cost.h"
12 |
13 | namespace ell
14 | {
15 | namespace model
16 | {
17 | namespace optimizer
18 | {
19 | /// Represents a real-valued function on the output of a CostModel.
20 | class Objective
21 | {
22 | public:
23 | using ObjectiveValue = double;
24 |
25 | virtual ~Objective() = default;
26 |
27 | /// Returns the value of the objective for the given cost.
28 | virtual ObjectiveValue Evaluate(const Cost& cost) const = 0;
29 | };
30 | } // namespace optimizer
31 | } // namespace model
32 | } // namespace ell
33 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/ObjectiveTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ObjectiveTest.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // Objective class tests
13 | //
14 | void TestObjectives();
15 |
16 | void TestSimpleObjective();
17 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/OptimizerOptionsTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: OptimizerOptionsTest.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // OptimizerOptions class tests
13 | //
14 |
15 | void TestOptimizerOptions();
16 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/OptimizerTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: OptimizerTest.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // Optimizer class tests
13 | //
14 |
15 | void TestOptimizers();
16 |
17 | void TestTrivialOptimizer();
18 | void TestSequentialOptimizer();
19 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/include/TransformationTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: TransformationTest.h (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // Transformation class tests
13 | //
14 |
15 | void TestTransformations();
16 |
17 | void TestTrivialTransformation();
18 | void TestAddMetadataToOutputTransformation();
19 | void TestCombineNodesTransformation();
20 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/src/CostTest.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: CostTest.cpp (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "CostTest.h"
10 | #include "Cost.h"
11 |
12 | #include
13 |
14 | using namespace ell::model::optimizer;
15 | using namespace ell::testing;
16 |
17 | //
18 | // Cost class tests
19 | //
20 | void TestCosts()
21 | {
22 | Cost perfCost;
23 | perfCost["runtime"] = HeuristicCostValue(5);
24 | ProcessTest("Testing PerfCost value", perfCost.GetCostComponent("runtime").GetValue() == 5);
25 | ProcessTest("Testing PerfCost value", perfCost.GetCostComponent("somethingelse").GetValue() == 0);
26 | }
27 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/src/ExampleObjectives.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ExampleObjectives.cpp (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "ExampleObjectives.h"
10 |
11 | using namespace ell::model;
12 |
13 | // SimpleObjective
14 | double SimpleObjective::Evaluate(const optimizer::Cost& cost) const
15 | {
16 | return cost.GetCostComponent("runtime").GetValue();
17 | }
18 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/src/ExampleOptimizers.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ExampleOptimizers.cpp (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "ExampleOptimizers.h"
10 | #include "ExampleCostModels.h"
11 | #include "ExampleObjectives.h"
12 |
13 | TrivialOptimizer::TrivialOptimizer() :
14 | ell::model::optimizer::Optimizer(SimpleCostModel{}, SimpleObjective{}){};
15 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/src/ObjectiveTest.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ObjectiveTest.cpp (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "ObjectiveTest.h"
10 | #include "OptimizerTestUtil.h"
11 | #include "ExampleObjectives.h"
12 |
13 | #include
14 |
15 | using namespace ell::model::optimizer;
16 | using namespace ell::testing;
17 |
18 | //
19 | // Objective class tests
20 | //
21 | void TestObjectives()
22 | {
23 | TestSimpleObjective();
24 | }
25 |
26 | void TestSimpleObjective()
27 | {
28 | SimpleObjective objective;
29 | Cost cost;
30 | cost["runtime"] = HeuristicCostValue(10);
31 | ProcessTest("Testing SimpleObjective", objective.Evaluate(cost) == 10);
32 | }
33 |
--------------------------------------------------------------------------------
/libraries/model/optimizer/test/src/main.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: main.cpp (model/optimizer_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | //
10 | // Global optimizer tests
11 | //
12 |
13 | #include "CostModelTest.h"
14 | #include "CostTest.h"
15 | #include "EnvironmentTest.h"
16 | #include "ObjectiveTest.h"
17 | #include "OptimizerOptionsTest.h"
18 | #include "OptimizerTest.h"
19 | #include "TransformationTest.h"
20 |
21 | #include
22 |
23 | using namespace ell::testing;
24 |
25 | int main()
26 | {
27 | TestExampleCostModels();
28 |
29 | TestCosts();
30 |
31 | TestEnvironment();
32 |
33 | TestObjectives();
34 |
35 | TestOptimizerOptions();
36 |
37 | TestOptimizers();
38 |
39 | TestTransformations();
40 |
41 | return GetExitCode();
42 | }
43 |
--------------------------------------------------------------------------------
/libraries/model/src/ModelEditor.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ModelEditor.cpp (model)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "ModelEditor.h"
10 |
11 | namespace ell
12 | {
13 | namespace model
14 | {
15 |
16 | void ModelEditor::ResetInputPort(const InputPortBase* port, const OutputPortBase& newInput)
17 | {
18 | // Luckily nothing is ever really const in the codebase. If that changes, this is UB
19 | const_cast(port)->SetReferencedPort(&newInput);
20 | }
21 |
22 | } // namespace model
23 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/model/src/OptimizeModelTransformation.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: OptimizeModelTransformation.cpp (model)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "OptimizeModelTransformation.h"
10 | #include "TransformationRegistry.h"
11 |
12 | namespace ell
13 | {
14 | namespace model
15 | {
16 | Submodel OptimizeModelTransformation::Transform(const Submodel& submodel, ModelTransformer& transformer, const TransformContext& context) const
17 | {
18 | Submodel result = submodel;
19 | const auto& registry = TransformationRegistry::GetGlobalRegistry();
20 |
21 | for (const auto& transformation : registry)
22 | {
23 | result = transformation->Transform(result, transformer, context);
24 | }
25 | return result;
26 | }
27 | } // namespace model
28 | } // namespace ell
29 |
--------------------------------------------------------------------------------
/libraries/model/src/Transformation.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Transformation.cpp (model)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "Transformation.h"
10 |
11 | namespace ell
12 | {
13 | namespace model
14 | {
15 | Model Transformation::TransformModel(const Model& model, ModelTransformer& transformer, const TransformContext& context) const
16 | {
17 | model::Submodel oldSubmodel{ model };
18 | auto newSubmodel = Transform(oldSubmodel, transformer, context);
19 | return newSubmodel.GetModel().ShallowCopy();
20 | }
21 | } // namespace model
22 | } // namespace ell
23 |
--------------------------------------------------------------------------------
/libraries/model/src/TransformationRegistry.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: TransformationRegistry.cpp (model)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "TransformationRegistry.h"
10 |
11 | namespace ell
12 | {
13 | namespace model
14 | {
15 | TransformationRegistry& TransformationRegistry::GetGlobalRegistry()
16 | {
17 | static TransformationRegistry registry;
18 | return registry;
19 | }
20 | } // namespace model
21 | } // namespace ell
22 |
--------------------------------------------------------------------------------
/libraries/model/test/clang/DotProduct.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DotProduct.cpp (compile_test)
5 | // Authors: Umesh Madan, Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | // compile with clang -S -emit-llvm -o DotProduct.ll DotProduct.cpp
10 |
11 | extern "C" {
12 | void _Node__DotProduct(double* input1, double* input2, int size, double* output)
13 | {
14 | double result = 0;
15 | for (int index = 0; index < size; ++index)
16 | {
17 | result += input1[index] * input2[index];
18 | }
19 | output[0] = result;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/libraries/model/test/clang/clang-options.md:
--------------------------------------------------------------------------------
1 | Useful optimizations for FP math:
2 |
3 | -ffast-math
4 | -fno-signed-zeros
5 | -freciprocal-math -- allow division operations to be reassociated
6 | -fstrict-enums -- enable optimizations based on enum value range
7 |
8 | -funroll-loops
9 | -fno-unroll-loops
10 | -freroll-loops
11 | -fno-reroll-loops
12 | -fmglobal-merge -- enable merging of globals
13 |
14 | -fwhole-program-vtables (requires -flto)
15 | -flto -- enable LTO in 'full' mode (???)
16 |
17 | -save-temps -- save intermediate compilation results
18 |
19 |
--------------------------------------------------------------------------------
/libraries/model/test/clang/generateIR.cmd:
--------------------------------------------------------------------------------
1 | clang -S -emit-llvm -o DotProduct.ll DotProduct.cpp
2 |
3 | echo "// IR code for dot product" > DotProductIR.h
4 | echo "const char* GetDotProductFunctionName()" >> DotProductIR.h
5 | echo "{" >> DotProductIR.h
6 | echo " return \"_Node__DotProduct\";" >> DotProductIR.h
7 | echo "}" >> DotProductIR.h
8 |
9 | echo "const char* GetDotProductIR()" >> DotProductIR.h
10 | echo "{" >> DotProductIR.h
11 | echo " return R\"xx(" >> DotProductIR.h
12 | type DotProduct.ll >> DotProductIR.h
13 | echo ")xx\";" >> DotProductIR.h
14 | echo "}" >> DotProductIR.h
15 |
--------------------------------------------------------------------------------
/libraries/model/test/clang/generateIR.sh:
--------------------------------------------------------------------------------
1 | set -e
2 |
3 | clang -S -emit-llvm -o DotProduct.ll DotProduct.cpp
4 |
5 | echo "// IR code for dot product" > DotProductIR.h
6 | echo "const char* GetDotProductFunctionName()" >> DotProductIR.h
7 | echo "{" >> DotProductIR.h
8 | echo " return \"_Node__DotProduct\";" >> DotProductIR.h
9 | echo "}" >> DotProductIR.h
10 |
11 | echo "const char* GetDotProductIR()" >> DotProductIR.h
12 | echo "{" >> DotProductIR.h
13 | echo " return R\"xx(" >> DotProductIR.h
14 | cat DotProduct.ll >> DotProductIR.h
15 | echo ")xx\";" >> DotProductIR.h
16 | echo "}" >> DotProductIR.h
17 |
--------------------------------------------------------------------------------
/libraries/model/test/include/CompilableCodeNode_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: CompilableCodeNode_test.h (model)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void CompilableCodeNode_test1();
14 | } // namespace ell
15 |
--------------------------------------------------------------------------------
/libraries/model/test/include/Map_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Map_test.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestMapCreate();
11 | void TestMapCompute();
12 | void TestMapComputeDataVector();
13 | void TestMapRefine();
14 | void TestMapSerialization();
15 | void TestMapClockNode();
16 |
--------------------------------------------------------------------------------
/libraries/model/test/include/Metadata_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Metadata_test.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestModelMetadata();
11 |
--------------------------------------------------------------------------------
/libraries/model/test/include/ModelHeaderOutputTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ModelHeaderOutputTest.h (nodes_test)
5 | // Authors: Lisa Ong
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | // The main test:
11 | void TestModelHeaderOutput();
12 |
--------------------------------------------------------------------------------
/libraries/model/test/include/ModelOptimizerOptions_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ModelOptimizerOptions_test.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | // High-level test
11 | void TestModelOptimizerOptions();
12 |
13 | // Lower-level tests (called by the above)
14 | void TestArchiveModelOptimizerOptions();
15 | void TestModelOptimizerOptionsMetadata();
16 |
--------------------------------------------------------------------------------
/libraries/model/test/include/ModelTransformerTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ModelTransformerTest.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestCopySubmodel();
11 | void TestCopySubmodelOnto();
12 | void TestTransformSubmodelOnto();
13 | void TestTransformSubmodelInPlace();
14 |
--------------------------------------------------------------------------------
/libraries/model/test/include/Model_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Model_test.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestStaticModel();
11 | void TestNodeIterator();
12 | void TestReverseNodeIterator();
13 |
14 | void TestModelSerialization();
15 | void TestModelMetadata();
16 |
17 | void TestInputRouting();
18 |
19 | void TestDeepCopyModel();
20 | void TestShallowCopyModel();
21 |
22 | void TestRefineSplitOutputs();
23 | void TestCustomRefine();
24 | void TestChangeInputForNode();
25 |
--------------------------------------------------------------------------------
/libraries/model/test/include/PerformanceCountersTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: PerformanceCountersTest.h (compile_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestPerformanceCounters();
12 |
--------------------------------------------------------------------------------
/libraries/model/test/include/PortElements_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: PortElements_test.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | void TestSlice();
11 | void TestAppend();
12 | void TestParsePortElements();
13 |
14 | void TestConvertPortElements();
--------------------------------------------------------------------------------
/libraries/model/test/include/Submodel_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Submodel_test.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | // Main test driver
11 | void TestSubmodels();
12 |
13 | // Individual tests
14 | void TestSubmodelConstructors();
15 | void TestSubmodelVisit();
16 |
--------------------------------------------------------------------------------
/libraries/model_testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | set(library_name model_testing)
6 |
7 | set(src
8 | src/ModelTestUtilities.cpp
9 | )
10 | set(include
11 | include/ModelTestUtilities.h
12 | )
13 |
14 | source_group("src" FILES ${src})
15 | source_group("include" FILES ${include})
16 |
17 | add_library(${library_name} ${src} ${include})
18 | target_include_directories(${library_name} PRIVATE include ${ELL_LIBRARIES_DIR})
19 | target_link_libraries(${library_name} common utilities model nodes emitters testing)
20 |
21 | set_property(TARGET ${library_name} PROPERTY FOLDER "libraries")
22 |
--------------------------------------------------------------------------------
/libraries/nodes/include/MatrixMatrixMultiplyImplementation.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: MatrixMatrixMultiplyImplementation.h (nodes)
5 | // Authors: Mason Remy, Denny Sun
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | namespace nodes
14 | {
15 | enum class MatrixMatrixMultiplyImplementation : int
16 | {
17 | SimpleForLoops = 0,
18 | Mlas_Loopnest_Value,
19 | LAST,
20 | DEFAULT = Mlas_Loopnest_Value
21 | };
22 | } // namespace nodes
23 | } // namespace ell
24 |
--------------------------------------------------------------------------------
/libraries/nodes/src/ConstantNode.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ConstantNode.cpp (nodes)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "ConstantNode.h"
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | namespace nodes
16 | {
17 | ConstantNode* AddNodeToModelTransformer(const model::PortElements& input, const predictors::ConstantPredictor& predictor, model::ModelTransformer& transformer)
18 | {
19 | return transformer.AddNode>(predictor.GetValue());
20 | }
21 | } // namespace nodes
22 | } // namespace ell
23 |
--------------------------------------------------------------------------------
/libraries/nodes/test/include/AppendNodesTests.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: AppendNodesTest.h (nodes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestAppendNodes();
12 |
13 | void TestAppenBinaryOperation();
14 | void TestConstant();
15 | void TestSum();
16 | void TestAppenUnaryOperation();
17 |
--------------------------------------------------------------------------------
/libraries/nodes/test/include/DSPCodeNodesTests.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DSPCodeNodesTest.h (nodes_test)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | void TestDSPCodeNodes(const std::string& path);
14 |
15 |
--------------------------------------------------------------------------------
/libraries/nodes/test/include/DSPNodesTests.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DSPNodesTests.h (nodes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | void TestDSPNodes(const std::string& path);
14 |
--------------------------------------------------------------------------------
/libraries/nodes/test/include/DSPNodesTiming.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: DSPNodesTiming.h (nodes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TimeDSPNodes();
12 |
--------------------------------------------------------------------------------
/libraries/nodes/test/include/NeuralNetworkLayerNodesTests.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: NeuralNetworkLayerNodesTest.h (nodes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestNeuralNetworkLayerNodes();
12 |
--------------------------------------------------------------------------------
/libraries/nodes/test/include/NodesTestData.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: NodesTestData.h (nodes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | template
14 | std::vector GetConvolutionTestData();
15 |
16 | template
17 | std::vector GetConvolutionTestFilter();
18 |
19 | template
20 | std::vector GetConvolutionTestResultSame();
21 |
22 | template
23 | std::vector GetCorrelationTestResultSame();
24 |
--------------------------------------------------------------------------------
/libraries/nodes/test/include/NodesTests.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: NodesTest.h (nodes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestNodes();
12 |
--------------------------------------------------------------------------------
/libraries/nodes/test/src/timing_main.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: main.cpp (nodes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "DSPNodesTiming.h"
10 |
11 | #include
12 |
13 | #include
14 | #include
15 |
16 | #include
17 |
18 | using namespace ell;
19 |
20 | /// Runs all tests
21 | ///
22 | int main(int argc, char** argv)
23 | {
24 | UNUSED(argc);
25 | UNUSED(argv);
26 | try
27 | {
28 | TimeDSPNodes();
29 | }
30 | catch (const utilities::Exception& exception)
31 | {
32 | std::cerr << "ERROR, got ELL exception. Message: " << exception.GetMessage() << std::endl;
33 | throw;
34 | }
35 |
36 | if (testing::DidTestFail())
37 | {
38 | return 1;
39 | }
40 |
41 | return 0;
42 | }
43 |
--------------------------------------------------------------------------------
/libraries/optimization/test/include/Other_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Other_test.h (optimization_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | /// Tests the correctness of the L1Prox function.
12 | void TestL1Prox();
13 |
14 | /// Tests the correctness of the LInfinityProx function.
15 | void TestLInfinityProx();
16 |
17 | /// Exercises the compilation path for MatrixDataset.
18 | void TestMatrixDataset();
19 |
--------------------------------------------------------------------------------
/libraries/optimization/test/include/Regularizer_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Regularizer_test.h (optimization_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | /// Tests that regularizers are equivalent, given the right parameters.
12 | void TestRegularizerEquivalence(double regularizationParameter);
13 |
--------------------------------------------------------------------------------
/libraries/optimization/test/include/Search_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Search_test.h (optimization_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestExponentialSearch();
12 | void TestBinarySearch();
13 | void TestGoldenSectionSearch();
--------------------------------------------------------------------------------
/libraries/passes/include/StandardTransformations.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: StandardTransformations.h (passes)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | namespace passes
16 | {
17 | /// Add standard transformations to the global transformation registry
18 | void AddStandardTransformationsToRegistry();
19 |
20 | /// Add standard transformations to a transformation registry
21 | void AddStandardTransformationsToRegistry(model::TransformationRegistry& registry);
22 | } // namespace passes
23 | } // namespace ell
24 |
--------------------------------------------------------------------------------
/libraries/passes/test/include/ModelOptimizerTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ModelOptimizerTest.h (model_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void TestFuseLinearOpsPass();
12 |
13 | void TestOptimizeReorderDataNodes1();
14 | void TestOptimizeReorderDataNodes2();
15 | void TestOptimizeReorderDataNodes3();
16 | void TestOptimizeReorderDataNodes4();
17 |
18 | void TestSetConvolutionMethodPass();
19 |
--------------------------------------------------------------------------------
/libraries/passes/test/include/TransformationTest.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: TransformationTest.h (passes/passes_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | //
12 | // Transformation class tests
13 | //
14 |
15 | void TestTransformations();
16 |
17 | void TestFuseLinearOperationsTransformation();
18 | void TestSetConvolutionMethodTransformation();
19 | void TestOptimizeReorderDataNodesTransformation();
20 |
--------------------------------------------------------------------------------
/libraries/predictors/include/IPredictor.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: IPredictor.h (predictors)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | namespace predictors
14 | {
15 | /// Base class for predictors.
16 | ///
17 | /// The type of the predictions made by this predictor.
18 | template
19 | class IPredictor
20 | {
21 | public:
22 | /// The prediction type.
23 | using PredictionType = T;
24 | };
25 | } // namespace predictors
26 | } // namespace ell
27 |
--------------------------------------------------------------------------------
/libraries/predictors/test/include/ForestPredictorTests.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ForestPredictorTests.h (predictors_test)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | void ForestPredictorTest();
14 |
--------------------------------------------------------------------------------
/libraries/predictors/test/include/ProtoNNPredictorTests.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ProtoNNPredictorTests.h (predictors_test)
5 | // Authors: Suresh Iyengar
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | void ProtoNNPredictorTest();
12 |
--------------------------------------------------------------------------------
/libraries/testing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | set(library_name testing)
6 |
7 | set(src
8 | src/testing.cpp
9 | )
10 | set(include
11 | include/testing.h
12 | )
13 |
14 | source_group("src" FILES ${src})
15 | source_group("include" FILES ${include})
16 |
17 | add_library(${library_name} ${src} ${include})
18 | target_include_directories(${library_name} PRIVATE include ${ELL_LIBRARIES_DIR})
19 | target_link_libraries(${library_name} utilities)
20 |
21 | set_property(TARGET ${library_name} PROPERTY FOLDER "libraries")
22 |
--------------------------------------------------------------------------------
/libraries/trainers/src/MeanCalculator.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: MeanCalculator.cpp (trainers)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "MeanCalculator.h"
10 |
11 | namespace ell
12 | {
13 | namespace trainers
14 | {
15 | math::RowVector CalculateMean(const data::AnyDataset& anyDataset)
16 | {
17 | return CalculateTransformedMean(anyDataset, [](data::IndexValue x) { return x.value; });
18 | }
19 | } // namespace trainers
20 | } // namespace ell
21 |
--------------------------------------------------------------------------------
/libraries/utilities/doc/ArchiveVersionHistory.md:
--------------------------------------------------------------------------------
1 | ## ELL Archive version history
2 |
3 | | Version | Comments / Changes|
4 | |---------|-------------------|
5 | | 1 | old |
6 | | 2 | current |
7 | | 3 | adds metadata to Model, Node, Port, and Map |
8 | | 4 | adds shapes to SourceNode and SinkNode |
9 | | 5 | enabled unarchiving of refined models containing Neural Network layer Nodes, and Broadcast Unary Function Nodes |
10 | | 6 | adds a trigger to SinkNode |
11 |
12 | When objects start being able to read different format versions, there
13 | will be notes here about forward/backward compatibility:
14 |
15 | - Version can be read by: (oldest code version that can still read this)
16 | - Version can read: (oldest archive version still readable)
17 |
--------------------------------------------------------------------------------
/libraries/utilities/doc/ArchiveVersioning.md:
--------------------------------------------------------------------------------
1 | ## ELL archive versioning
2 |
3 | Whenever an IArchivable object updates its archive representation, it should have a new version number. Instead of
4 | just incrementing that object's version number, increment the `ArchiveVersion::currentVersion` constant, and use
5 | that as the version number. This way, an archive's version number is the max of the version numbers of all its
6 | included objects.
7 |
8 | Whenever an archive version is incremented, make a note in the `ArchiveVersionHistory.md` file with the version
9 | number and what changed, and whether or not the change results in compatibility issues.
--------------------------------------------------------------------------------
/libraries/utilities/include/Debug.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Debug.h (utilities)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #pragma once
9 |
10 | #include "Exception.h"
11 |
12 | #ifndef NDEBUG
13 | #define DEBUG_THROW(condition, exception) \
14 | if (condition) throw exception
15 | #define DEBUG_CHECK_ARGUMENTS(condition, message) \
16 | if (condition) throw utilities::InputException(utilities::InputExceptionErrors::invalidArgument, message)
17 | #define DEBUG_CHECK_SIZES(condition, message) \
18 | if (condition) throw utilities::InputException(utilities::InputExceptionErrors::sizeMismatch, message)
19 | #else
20 | #define DEBUG_THROW(condition, exception)
21 | #define DEBUG_CHECK_ARGUMENTS(condition, exception)
22 | #define DEBUG_CHECK_SIZES(condition, message)
23 | #endif
24 |
--------------------------------------------------------------------------------
/libraries/utilities/include/PPMImageParser.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: PPMImageParser.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | namespace ell
17 | {
18 | namespace utilities
19 | {
20 | template
21 | struct Image
22 | {
23 | size_t width;
24 | size_t height;
25 | size_t numChannels;
26 | std::vector data;
27 | };
28 |
29 | template
30 | Image ParsePPMStream(std::istream& in);
31 |
32 | template
33 | Image ParsePPMFile(const std::string& filename);
34 | } // namespace utilities
35 | } // namespace ell
36 |
--------------------------------------------------------------------------------
/libraries/utilities/include/StlVectorUtil.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: StlVectorUtil.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 | #include
13 |
14 | namespace ell
15 | {
16 | namespace utilities
17 | {
18 | template
19 | auto TransformVector(ForwardIterator begin, ForwardIterator end, UnaryOperation op)
20 | {
21 | using ResultType = decltype(op(*begin));
22 | auto size = std::distance(begin, end);
23 | std::vector result;
24 | result.reserve(size);
25 | std::transform(begin, end, std::back_inserter(result), op);
26 | return result;
27 | }
28 | } // namespace utilities
29 | } // namespace ell
30 |
--------------------------------------------------------------------------------
/libraries/utilities/src/IArchivable.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: IArchivable.cpp (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "IArchivable.h"
10 | #include "Archiver.h"
11 | #include "ObjectArchiver.h"
12 |
13 | namespace ell
14 | {
15 | namespace utilities
16 | {
17 | ObjectArchive GetDescription(const IArchivable& object)
18 | {
19 | utilities::SerializationContext context;
20 | utilities::ObjectArchiver archiver(context);
21 | archiver.Archive(object);
22 | return archiver.GetObjectArchive();
23 | }
24 |
25 | bool IArchivable::CanReadArchiveVersion(const ArchiveVersion& version) const
26 | {
27 | return version == GetArchiveVersion();
28 | }
29 | } // namespace utilities
30 | } // namespace ell
31 |
--------------------------------------------------------------------------------
/libraries/utilities/src/UniqueNameList.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: UniqueNameList.cpp (utilities)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "UniqueNameList.h"
10 |
11 | namespace ell
12 | {
13 | namespace utilities
14 | {
15 | std::string UniqueNameList::Add(const std::string& name)
16 | {
17 | std::string result = name;
18 | auto count = _table[name];
19 | if (count > 0)
20 | {
21 | result += std::to_string(count);
22 | }
23 | _table[name] += 1;
24 | return result;
25 | }
26 | } // namespace utilities
27 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/utilities/test/include/Archiver_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Archiver_test.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestArchivedObjectInfo();
14 | void TestArchiveVersion();
15 |
16 | void TestJsonArchiver();
17 | void TestJsonUnarchiver();
18 |
19 | void TestXmlArchiver();
20 | void TestXmlUnarchiver();
21 | } // namespace ell
22 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/Files_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Files_test.h (utilities)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 | #include
9 |
10 | namespace ell
11 | {
12 | void TestStringf();
13 | void TestJoinPaths(const std::string& basePath);
14 | #ifdef WIN32
15 | void TestUnicodePaths(const std::string& basePath);
16 | #endif
17 | } // namespace ell
18 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/Format_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Format_test.h (utilities)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestMatchFormat();
14 | }
15 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/FunctionUtils_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: FunctionUtils_test.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestInOrderFunctionEvaluator();
14 | void TestApplyToEach();
15 | void TestFunctionTraits();
16 | } // namespace ell
17 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/Hash_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Hash_test.h (utilities)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 |
14 | void Hash_test1();
15 |
16 | } // namespace ell
17 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/Iterator_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Iterator_test.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | namespace ell
10 | {
11 | void TestIteratorAdapter();
12 | void TestTransformIterator();
13 | void TestParallelTransformIterator();
14 |
15 | void TestStlStridedIterator();
16 | void TestZipIterator();
17 | } // namespace ell
18 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/MemoryLayout_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: MemoryLayout_test.h (utilities)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 |
14 | void TestDimensionOrder();
15 | void TestMemoryLayoutCtors();
16 | void TestMemoryLayoutSlice();
17 | void TestMemoryLayoutHash();
18 | void TestScalarLayout();
19 | void TestInflateMemoryLayout();
20 | void TestInflateNullMemoryLayout();
21 | } // namespace ell
22 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/ObjectArchive_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Archiver_test.h (utilities)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestGetTypeDescription();
14 | void TestGetObjectArchive();
15 | void TestSerializeIArchivable();
16 | void TestObjectArchiver();
17 | } // namespace ell
18 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/PropertyBag_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: PropertyBag_test.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestPropertyBag();
14 | void TestRecursivePropertyBag();
15 | }
16 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/RingBuffer_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: RingBuffer_test.h (utilities)
5 | // Authors: Chris Lovett
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestRingBuffer();
14 | }
15 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/TunableParameters_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: TunableParameters_test.h (utilities)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TunableParameters_test1();
14 | void TunableParameters_test2();
15 | } // namespace ell
16 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/TypeFactory_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: TypeFactory_test.h (utilities)
5 | // Authors: Ofer Dekel
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TypeFactoryTest();
14 | }
15 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/TypeName_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: TypeName_test.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestFundamentalTypeNames();
14 | void TestClassTypeNames();
15 | void TestEnumTypeNames();
16 | } // namespace ell
17 |
--------------------------------------------------------------------------------
/libraries/utilities/test/include/Variant_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Variant_test.h (utilities)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | void TestScalarVariant();
14 | void TestVectorVariant();
15 | void TestObjectVariant();
16 |
17 | void TestVariantGetValueAs();
18 |
19 | void TestVariantParseSimple();
20 | void TestParseVectorVaraint();
21 | void TestParsePortElementsProxyVariant();
22 | void TestParseObjVariant();
23 |
24 | void TestVariantToString();
25 | void TestVariantArchive();
26 | } // namespace ell
27 |
--------------------------------------------------------------------------------
/libraries/utilities/test/src/Hash_test.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Hash_test.cpp (utilities)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "Hash_test.h"
10 |
11 | #include
12 |
13 | #include
14 |
15 | #include
16 | #include
17 |
18 | namespace ell
19 | {
20 |
21 | void Hash_test1()
22 | {
23 | bool ok = true;
24 | ok &= testing::IsEqual(std::hash{}(3), utilities::HashValue(3));
25 | {
26 | size_t seed = 0;
27 | utilities::HashCombine(seed, 3);
28 | ok &= testing::IsEqual(seed, utilities::HashValue(std::tuple{ 3 }));
29 | }
30 | ok &= testing::IsTrue(utilities::HashValue(std::vector{ 1, 2, 3 }) != utilities::HashValue(std::vector{ 3, 2, 1 }));
31 | testing::ProcessTest("Hash utility test", ok);
32 | }
33 |
34 | } // namespace ell
35 |
--------------------------------------------------------------------------------
/libraries/value/include/ScalarOperations.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: ScalarOperations.h (value)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | namespace value
16 | {
17 |
18 | class Scalar;
19 |
20 | /// Arithmetic operators
21 | Scalar Add(Scalar, Scalar);
22 | Scalar Subtract(Scalar, Scalar);
23 | Scalar Multiply(Scalar, Scalar);
24 | Scalar Divide(Scalar, Scalar);
25 | Scalar Modulo(Scalar, Scalar);
26 | Scalar FusedMultiplyAdd(Scalar a, Scalar b, Scalar c); // returns (a*b)+c
27 |
28 | } // namespace value
29 | } // namespace ell
30 |
--------------------------------------------------------------------------------
/libraries/value/src/Emittable.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Emittable.cpp (value)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #include "Emittable.h"
10 |
11 | namespace ell
12 | {
13 | namespace value
14 | {
15 |
16 | Emittable::Emittable() = default;
17 |
18 | Emittable::Emittable(void* data) :
19 | _data(data) {}
20 |
21 | } // namespace value
22 | } // namespace ell
--------------------------------------------------------------------------------
/libraries/value/test/include/Functions_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Functions_test.h (value)
5 | // Authors: Kern Handa, Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 |
16 | value::Scalar FunctionArgType_test();
17 |
18 | } // namespace ell
19 |
--------------------------------------------------------------------------------
/libraries/value/test/include/LoopNest_convolution_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: LoopNest_convolution_test.h (value)
5 | // Authors: Mason Remy
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | namespace ell
12 | {
13 | namespace value
14 | {
15 | class Scalar;
16 | }
17 |
18 | } // namespace ell
19 |
--------------------------------------------------------------------------------
/libraries/value/test/include/Matrix_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Matrix_test.h (value)
5 | // Authors: Kern Handa, Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | value::Scalar Matrix_test1();
16 | value::Scalar Matrix_test2();
17 | value::Scalar Matrix_test3();
18 | value::Scalar Matrix_test4();
19 | value::Scalar Reshape_test();
20 | value::Scalar GEMV_test();
21 | value::Scalar MatrixReferenceTest();
22 | value::Scalar RefMatrixReferenceTest();
23 | } // namespace ell
24 |
--------------------------------------------------------------------------------
/libraries/value/test/include/Scalar_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Scalar_test.h (value)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | value::Scalar Scalar_test1();
16 | value::Scalar Scalar_test2();
17 | value::Scalar ScalarRefTest();
18 | value::Scalar ScalarRefRefTest();
19 | value::Scalar ScalarRefRefRefTest();
20 | value::Scalar RefScalarRefTest();
21 | value::Scalar RefScalarRefCtorsTest();
22 | value::Scalar RefScalarRefRefTest();
23 | value::Scalar RefScalarRefRefRefTest();
24 | value::Scalar SequenceLogicalAndTest();
25 | value::Scalar SequenceLogicalAndTestWithCopy();
26 | } // namespace ell
27 |
--------------------------------------------------------------------------------
/libraries/value/test/include/Tensor_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Tensor_test.h (value)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | value::Scalar Tensor_test1();
16 | value::Scalar Tensor_test2();
17 | value::Scalar Tensor_test3();
18 | value::Scalar Tensor_slice_test1();
19 | } // namespace ell
20 |
--------------------------------------------------------------------------------
/libraries/value/test/include/Vector_test.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: Vector_test.h (value)
5 | // Authors: Kern Handa
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include
12 |
13 | namespace ell
14 | {
15 | value::Scalar Vector_test1();
16 | value::Scalar Vector_test2();
17 | value::Scalar Vector_test3();
18 | value::Scalar Vector_test4();
19 | value::Scalar Vector_test5();
20 | } // namespace ell
21 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | configparser
2 | opencv-python
3 | dask
4 | flake8
5 | python-dateutil
6 | librosa
7 | matplotlib
8 | numpy
9 | onnx
10 | paramiko
11 | parse
12 | psutil
13 | pyaudio
14 | python_speech_features
15 | requests
16 | serial
17 | # optional (very large):
18 | # https://download.pytorch.org/whl/cu90/torch-1.0.0-cp36-cp36m-win_amd64.whl
19 | # torchvision
--------------------------------------------------------------------------------
/scripts/CI/Linux/azure-jekyll-build.yml:
--------------------------------------------------------------------------------
1 |
2 | trigger:
3 | - master
4 |
5 | pool:
6 | vmImage: 'ubuntu-16.04'
7 |
8 | container: cjlovett/ell-dependencies:latest
9 |
10 | steps:
11 | - script: |
12 | bundle install
13 | displayName: 'install gem packages'
14 |
15 | - script: |
16 | bundle exec jekyll build --verbose
17 | displayName: 'build website'
18 |
--------------------------------------------------------------------------------
/scripts/CI/Linux/azure-linux-build.yml:
--------------------------------------------------------------------------------
1 |
2 | trigger:
3 | - master
4 |
5 | pool:
6 | vmImage: 'ubuntu-16.04'
7 |
8 | container: cjlovett/ell-dependencies:latest
9 |
10 | steps:
11 | - bash: |
12 | source activate py37
13 | conda env list
14 | mkdir build_gcc8
15 | cd build_gcc8
16 | cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++-8 -DCMAKE_C_COMPILER=/usr/bin/gcc-8 -DCMAKE_BUILD_TYPE=Release -DSTRICT_MODE=ON -DUSE_COMPILER_CACHE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DONNX=ON ..
17 | make -j8
18 | displayName: 'ELL build using G++'
19 |
20 | - bash: |
21 | source activate py37
22 | conda env list
23 | ctest -j4 -VV --timeout 600 -T Test
24 | displayName: 'Run ctest in build_gcc8'
25 | workingDirectory: 'build_gcc8'
26 |
27 | - task: PublishTestResults@2
28 | displayName: 'Publish Test Results **/Test.xml'
29 | inputs:
30 | testResultsFormat: CTest
31 | testResultsFiles: '**/Test.xml'
32 | searchFolder: '$(Build.SourcesDirectory)/build_gcc8/Testing'
33 | condition: succeededOrFailed()
--------------------------------------------------------------------------------
/scripts/CI/Linux/azure-linux-clang-build.yml:
--------------------------------------------------------------------------------
1 |
2 | trigger:
3 | - master
4 |
5 | pool:
6 | vmImage: 'ubuntu-16.04'
7 |
8 | container: cjlovett/ell-dependencies:latest
9 |
10 | steps:
11 | - bash: |
12 | source activate py37
13 | conda env list
14 | mkdir build_clang8
15 | cd build_clang8
16 | cmake -DCMAKE_CXX_COMPILER=/usr/bin/clang++-8 -DCMAKE_C_COMPILER=/usr/bin/clang-8 -DCMAKE_BUILD_TYPE=Release -DSTRICT_MODE=ON -DUSE_COMPILER_CACHE=ON -DONNX=ON ..
17 | make -j8
18 | displayName: 'ELL Build with clang'
19 |
20 | - bash: |
21 | source activate py37
22 | conda env list
23 | ctest -j4 -VV --timeout 600 -T Test
24 | displayName: 'Run ctest in build_gcc8'
25 | workingDirectory: 'build_clang8'
26 |
27 | - task: PublishTestResults@2
28 | displayName: 'Publish Test Results **/Test.xml'
29 | inputs:
30 | testResultsFormat: CTest
31 | testResultsFiles: '**/Test.xml'
32 | searchFolder: '$(Build.SourcesDirectory)/build_clang8/Testing'
33 | condition: succeededOrFailed()
--------------------------------------------------------------------------------
/scripts/rebuild.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | Setlocal EnableDelayedExpansion
3 |
4 | pushd %~dp0
5 |
6 | if not exist build goto :build
7 |
8 | set retry=10
9 |
10 | :retry
11 | set /A retry=!retry!-1
12 | if "!retry!"=="0" goto :nodelete
13 | if not exist build goto :build
14 | rd /s /q build
15 | powershell -nologo -noprofile -command "start-sleep 2"
16 | goto :retry
17 |
18 |
19 | :build
20 | call build.cmd %1 %2 %3 %4 %5
21 | if ERRORLEVEL 1 exit /B 1
22 |
23 | goto :eof
24 |
25 | :nodelete
26 | echo Error deleting 'build' folder, is it locked?
27 | exit /B 1
28 |
--------------------------------------------------------------------------------
/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file for Embedded Learning Library subprojects
3 | #
4 |
5 | set(ELL_LIBRARIES_DIR ${CMAKE_CURRENT_LIST_DIR}/../libraries)
6 |
7 | add_subdirectory(importers)
8 | add_subdirectory(trainers)
9 | add_subdirectory(utilities)
10 | add_subdirectory(wrap)
11 |
--------------------------------------------------------------------------------
/tools/importers/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file for Embedded Learning Library subprojects
3 | #
4 |
5 | add_subdirectory(CNTK)
6 | add_subdirectory(common)
7 | add_subdirectory(darknet)
8 | add_subdirectory(onnx)
9 | add_subdirectory(torch)
10 |
--------------------------------------------------------------------------------
/tools/importers/CNTK/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${PYTHON_ENABLED} AND ${CNTK})
6 |
7 | set(module_name "cntk_importer")
8 |
9 | set(importer_src cntk_to_ell.py
10 | cntk_import.py
11 | custom_functions.py)
12 |
13 | set(importer_lib lib/cntk_converters.py
14 | lib/cntk_layers.py
15 | lib/cntk_utilities.py)
16 |
17 | source_group("lib" FILES ${importer_lib})
18 |
19 | add_custom_target(${module_name} DEPENDS SOURCES ${importer_src} ${importer_lib})
20 | add_dependencies(${module_name} pythonlibs)
21 |
22 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/importers")
23 |
24 | # copy files
25 | copy_newer_files(${module_name} importer_src)
26 | copy_newer_files(${module_name} importer_lib "${CMAKE_CURRENT_BINARY_DIR}/lib/")
27 |
28 | add_subdirectory(test)
29 |
30 | # run flake8
31 | flake8(${module_name})
32 | endif() # PYTHON_ENABLED
33 |
--------------------------------------------------------------------------------
/tools/importers/CNTK/doc/vgg16-snippet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/tools/importers/CNTK/doc/vgg16-snippet.png
--------------------------------------------------------------------------------
/tools/importers/CNTK/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
6 | set(PYTHON_EXECUTABLE python)
7 | endif()
8 |
9 |
10 | if(${PYTHON_ENABLED} AND NOT APPLE)
11 | # test project
12 |
13 | set (test_name ${module_name}_test)
14 |
15 | set (test_src cntk_to_ell_importer_test.py)
16 | set (src ${test_src} cntk_full_model_test.py)
17 |
18 | set (test_data xorModel1.dnn)
19 |
20 | add_custom_target(${test_name} ALL DEPENDS ${src} SOURCES ${src})
21 | add_dependencies(${test_name} ${module_name})
22 |
23 | set_property(TARGET ${test_name} PROPERTY FOLDER "tests")
24 |
25 | # copy files
26 | copy_newer_files(${test_name} src)
27 | copy_newer_files(${test_name} test_data)
28 |
29 | add_test(NAME ${test_name} COMMAND ${PYTHON_EXECUTABLE} -m unittest ${test_src})
30 |
31 | endif() # PYTHON_ENABLED
32 |
--------------------------------------------------------------------------------
/tools/importers/CNTK/test/xorModel1.dnn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/tools/importers/CNTK/test/xorModel1.dnn
--------------------------------------------------------------------------------
/tools/importers/common/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${PYTHON_ENABLED})
6 |
7 | set(module_name "importers_common")
8 |
9 | set(common_src converters.py
10 | importer.py
11 | memory_shapes.py)
12 |
13 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${common_src})
14 |
15 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/importers")
16 |
17 | #copy files
18 | copy_newer_files(${module_name} common_src)
19 |
20 | add_subdirectory(test)
21 |
22 | # run flake8
23 | flake8(${module_name})
24 | endif() # PYTHON_ENABLED
25 |
--------------------------------------------------------------------------------
/tools/importers/common/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${PYTHON_ENABLED})
6 |
7 | set (test_name ${module_name}_test)
8 |
9 | set (test_src common_importer_test.py)
10 |
11 | add_custom_target(${test_name} DEPENDS ${test_src} SOURCES ${test_src})
12 |
13 | set_property(TARGET ${test_name} PROPERTY FOLDER "tests")
14 |
15 | # copy files
16 | foreach(PY_FILE ${test_src})
17 | configure_file(${PY_FILE} ${PY_FILE} COPYONLY)
18 | endforeach()
19 |
20 | endif() # PYTHON_ENABLED
21 |
--------------------------------------------------------------------------------
/tools/importers/darknet/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${PYTHON_ENABLED})
6 |
7 | set(module_name "darknet_importer")
8 |
9 | set(importer_src darknet_to_ell.py
10 | darknet_import.py)
11 |
12 | add_custom_target(${module_name} DEPENDS SOURCES ${importer_src})
13 | add_dependencies(${module_name} pythonlibs)
14 |
15 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/importers")
16 |
17 | #copy files
18 | copy_newer_files(${module_name} importer_src)
19 |
20 | add_subdirectory(test)
21 |
22 | # run flake8
23 | flake8(${module_name})
24 | endif() # PYTHON_ENABLED
25 |
--------------------------------------------------------------------------------
/tools/importers/darknet/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
6 | set(PYTHON_EXECUTABLE python)
7 | endif()
8 |
9 | if(${PYTHON_ENABLED})
10 | # test project
11 |
12 | set (test_name ${module_name}_test)
13 |
14 | set (test_src darknet_to_ell_importer_test.py)
15 |
16 | set (test_data unittest.cfg unittest.weights)
17 |
18 | add_custom_target(${test_name} ALL DEPENDS ${test_src} SOURCES ${test_src})
19 | add_dependencies(${test_name} ${module_name})
20 |
21 | set_property(TARGET ${test_name} PROPERTY FOLDER "tests")
22 |
23 | # copy files
24 | copy_newer_files(${test_name} test_src)
25 |
26 | # copy data files
27 | copy_newer_files(${test_name} test_data)
28 |
29 | add_test(NAME ${test_name} COMMAND ${PYTHON_EXECUTABLE} -m unittest ${test_src})
30 |
31 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/tools/importers/darknet/test/unittest.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=16
3 | subdivisions=1
4 | height=28
5 | width=28
6 | channels=1
7 | momentum=0.9
8 | decay=0.0005
9 |
10 | learning_rate=0.4
11 | policy=poly
12 | power=4
13 | max_batches=128
14 | momentum=0.9
15 | decay=0.0005
16 |
17 | [convolutional]
18 | batch_normalize=1
19 | filters=8
20 | size=3
21 | stride=1
22 | pad=1
23 | activation=leaky
24 |
25 | [maxpool]
26 | size=2
27 | stride=2
28 |
29 | [convolutional]
30 | batch_normalize=1
31 | filters=10
32 | size=3
33 | stride=1
34 | pad=1
35 | activation=leaky
36 |
37 | [avgpool]
38 |
39 | [softmax]
40 | groups=1
41 |
42 | [cost]
43 | type=sse
44 |
--------------------------------------------------------------------------------
/tools/importers/darknet/test/unittest.weights:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/tools/importers/darknet/test/unittest.weights
--------------------------------------------------------------------------------
/tools/importers/onnx/.gitignore:
--------------------------------------------------------------------------------
1 | out/
2 | __pycache__/
3 | models/
4 | host/
5 | .vscode/
6 | .DS_Store
7 | .DS_store?
8 |
9 | # Packages #
10 | *.zip
11 | *.tar
12 | *.7z
13 | *.rar
14 | *.gz
15 | *.ell
16 | *.onnx
17 | *.pth
18 |
19 |
--------------------------------------------------------------------------------
/tools/importers/onnx/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${PYTHON_ENABLED} AND ${ONNX})
6 |
7 | set(module_name "onnx_importer")
8 |
9 | set(importer_src onnx_to_ell.py onnx_import.py)
10 |
11 | set(importer_lib lib/onnx_converters.py)
12 |
13 | source_group("lib" FILES ${importer_lib})
14 | add_custom_target(${module_name} DEPENDS SOURCES ${importer_src} ${importer_lib})
15 | add_dependencies(${module_name} pythonlibs)
16 |
17 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/importers")
18 |
19 | #copy files
20 | copy_newer_files(${module_name} importer_src)
21 |
22 | #copy libs
23 | copy_newer_files(${module_name} importer_lib "${CMAKE_CURRENT_BINARY_DIR}/lib/")
24 |
25 | add_subdirectory(test)
26 |
27 | # run flake8
28 | flake8(${module_name})
29 | endif() # PYTHON_ENABLED
30 |
--------------------------------------------------------------------------------
/tools/importers/onnx/README.md:
--------------------------------------------------------------------------------
1 | # Note:
2 |
3 | This ONNX importer is still a work in progress. Currently, the only supported ONNX models are those exported from PyTorch.
4 |
5 | ### Environment setup
6 |
7 | You should have both [ONNX]("https://onnx.ai/") and [ELL]("https://microsoft.github.io/ELL") installed. To install ELL follow the instruction for your specific os ([Windows]("https://github.com/Microsoft/ELL/blob/master/INSTALL-Windows.md"), [Ubuntu Linux]("https://github.com/Microsoft/ELL/blob/master/INSTALL-Ubuntu.md"), [macOS]("https://github.com/Microsoft/ELL/blob/master/INSTALL-Mac.md") ). To install [ONNX]("https://onnx.ai/") and other required libraries, the best option is to use [Anaconda]("https://anaconda.org/").
8 |
9 | ### Import onnx model
10 |
11 | To install [ONNX]("https://onnx.ai/") and other required libraries, the best option is to use [Anaconda]("https://anaconda.org/")
12 |
13 | ### Convert a model
14 |
15 | To convert an ONNX model to the ELL format use the following:
16 |
17 | ```
18 | python onnx_import.py
19 | ```
20 |
--------------------------------------------------------------------------------
/tools/importers/onnx/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
6 | set(PYTHON_EXECUTABLE python)
7 | endif()
8 |
9 | if(${PYTHON_ENABLED})
10 | # test project
11 |
12 | set (test_name ${module_name}_test)
13 |
14 | set (test_src onnx_node_test.py)
15 |
16 | add_custom_target(${test_name} ALL DEPENDS ${test_src} SOURCES ${test_src})
17 | add_dependencies(${test_name} ${module_name})
18 |
19 | set_property(TARGET ${test_name} PROPERTY FOLDER "tests")
20 |
21 | # copy files
22 | copy_newer_files(${test_name} test_src)
23 |
24 | add_test(NAME ${test_name} COMMAND ${PYTHON_EXECUTABLE} -m unittest onnx_node_test.py)
25 |
26 | endif() # PYTHON_ENABLED
--------------------------------------------------------------------------------
/tools/importers/torch/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${PYTHON_ENABLED} AND ${ONNX})
6 |
7 | set(module_name "torch_importer")
8 |
9 | set(importer_src torch_verifier.py)
10 |
11 | add_custom_target(${module_name} DEPENDS SOURCES ${importer_src})
12 | add_dependencies(${module_name} onnx_importer pythonlibs)
13 |
14 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/importers")
15 |
16 | #copy files
17 | copy_newer_files(${module_name} importer_src)
18 |
19 | add_subdirectory(test)
20 |
21 | # run flake8
22 | flake8(${module_name})
23 | endif() # PYTHON_ENABLED
24 |
--------------------------------------------------------------------------------
/tools/importers/torch/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file
3 | #
4 |
5 | if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
6 | set(PYTHON_EXECUTABLE python)
7 | endif()
8 |
9 | if(${PYTHON_ENABLED})
10 | # test project
11 |
12 | set (test_name ${module_name}_test)
13 |
14 | set (test_src torch_importer_test.py custom_layers.py eight.jpg)
15 |
16 | add_custom_target(${test_name} ALL DEPENDS ${test_src} SOURCES ${test_src})
17 | add_dependencies(${test_name} ${module_name})
18 |
19 | set_property(TARGET ${test_name} PROPERTY FOLDER "tests")
20 |
21 | # copy files
22 | copy_newer_files(${test_name} test_src)
23 |
24 | # disabled until we merge with master
25 | # add_test(NAME ${test_name} COMMAND ${PYTHON_EXECUTABLE} -m unittest torch_importer_test.py)
26 |
27 | endif() # PYTHON_ENABLED
28 |
--------------------------------------------------------------------------------
/tools/importers/torch/test/eight.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/tools/importers/torch/test/eight.jpg
--------------------------------------------------------------------------------
/tools/trainers/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file for Embedded Learning Library subprojects
3 | #
4 |
5 | add_subdirectory(forestTrainer)
6 | add_subdirectory(linearTrainer)
7 | add_subdirectory(protoNNTrainer)
8 | add_subdirectory(retargetTrainer)
9 | add_subdirectory(sweepingSGDTrainer)
10 |
--------------------------------------------------------------------------------
/tools/trainers/retargetTrainer/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file for retarget project
3 | #
4 |
5 | # define project
6 | set(tool_name retargetTrainer)
7 |
8 | set(src
9 | src/main.cpp
10 | src/RetargetArguments.cpp)
11 |
12 | set(include
13 | include/RetargetArguments.h)
14 |
15 | set(docs README.md)
16 |
17 | source_group("src" FILES ${src})
18 | source_group("include" FILES ${include})
19 |
20 | # create executable in build\bin
21 | set (GLOBAL_BIN_DIR ${CMAKE_BINARY_DIR}/bin)
22 | set (EXECUTABLE_OUTPUT_PATH ${GLOBAL_BIN_DIR})
23 | add_executable(${tool_name} ${docs} ${include} ${src})
24 | target_include_directories(${tool_name} PRIVATE include ${ELL_LIBRARIES_DIR})
25 | target_link_libraries(${tool_name} common data functions model predictors trainers evaluators utilities)
26 | copy_shared_libraries(${tool_name})
27 |
28 | # put this project in the utilities folder in the IDE
29 | set_property(TARGET ${tool_name} PROPERTY FOLDER "tools/trainers")
30 |
--------------------------------------------------------------------------------
/tools/utilities/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # cmake file for Embedded Learning Library subprojects
3 | #
4 |
5 | add_subdirectory(apply)
6 | add_subdirectory(compile)
7 | add_subdirectory(datasetFromImages)
8 | add_subdirectory(debugCompiler)
9 | add_subdirectory(finetune)
10 | add_subdirectory(makeExamples)
11 | add_subdirectory(optimizer)
12 | add_subdirectory(pitest)
13 | add_subdirectory(print)
14 | add_subdirectory(profile)
15 | add_subdirectory(pythonlibs)
16 | add_subdirectory(pythonPlugins)
17 | add_subdirectory(remoterun)
18 |
19 | add_custom_target(tools)
20 | add_dependencies(tools apply compile debugCompiler finetune print profile pythonPlugins)
21 |
--------------------------------------------------------------------------------
/tools/utilities/datasetFromImages/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # CMake file for datasetFromImages utility script
3 | #
4 |
5 | if(${PYTHON_ENABLED})
6 |
7 | set(tool_name "datasetFromImages")
8 |
9 | set(src datasetFromImages.py)
10 |
11 | add_custom_target(${tool_name} ALL DEPENDS SOURCES ${src})
12 | add_dependencies(${tool_name} pythonlibs)
13 |
14 | # copy files
15 | copy_newer_files(${tool_name} src)
16 |
17 | # put this project in the tools/utilities folder in the IDE
18 | set_property(TARGET ${tool_name} PROPERTY FOLDER "tools/utilities")
19 |
20 | flake8(${tool_name})
21 | endif()
22 |
--------------------------------------------------------------------------------
/tools/utilities/finetune/test/include/LoadTestData.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Project: Embedded Learning Library (ELL)
4 | // File: LoadTestData.h (finetune_test)
5 | // Authors: Chuck Jacobs
6 | //
7 | ////////////////////////////////////////////////////////////////////////////////////////////////////
8 |
9 | #pragma once
10 |
11 | #include "DataUtils.h"
12 |
13 | #include