├── .clang-format ├── .editorconfig ├── .flake8 ├── .gitattributes ├── .gitignore ├── .travis.yml ├── CMake ├── AddPrecompiledHeader.cmake ├── CommonInterfaces.cmake ├── CompilerCache.cmake ├── CopySharedLibraries.cmake ├── Flake8.cmake ├── LLVMSetup.cmake ├── OpenBLASSetup.cmake └── SWIGSetup.cmake ├── CMakeLists.txt ├── Dockerfile ├── Doxyfile ├── Gemfile ├── History.md ├── INSTALL-Advanced.md ├── INSTALL-Mac.md ├── INSTALL-Ubuntu.md ├── INSTALL-Windows.md ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── StyleGuide.md ├── VERSION ├── Versioning.md ├── _config.yml ├── docs ├── _config.yml ├── _data │ ├── global.yml │ └── nav.yml ├── _includes │ ├── footer.html │ ├── head.html │ ├── header.html │ ├── homeheader.html │ ├── pagination.html │ ├── tile.html │ └── title-group.html ├── _layouts │ ├── default.html │ └── home.html ├── assets │ ├── css │ │ └── ie10-viewport-bug-workaround.css │ └── js │ │ └── ie10-viewport-bug-workaround.js ├── background.jpg ├── css │ ├── gallery.scss │ ├── syntax.scss │ └── theme.scss ├── gallery │ ├── ILSVRC2012 │ │ ├── Asparagus.md │ │ ├── Bean.md │ │ ├── BrazilianGuava.md │ │ ├── Buckthorn.md │ │ ├── Candlenut.md │ │ ├── Carrot.md │ │ ├── CashewNut.md │ │ ├── Chalta.md │ │ ├── Chenet.md │ │ ├── Clary.md │ │ ├── Clover.md │ │ ├── Coconut.md │ │ ├── Elderflower.md │ │ ├── GardenCress.md │ │ ├── Ginger.md │ │ ├── Mashua.md │ │ ├── PandanFlower.md │ │ ├── Pawpaw.md │ │ ├── Pear.md │ │ ├── SevenSisters.md │ │ ├── Sweetsop.md │ │ ├── Tamarind.md │ │ ├── WaterApple.md │ │ ├── Wattleseed.md │ │ ├── all_models.json │ │ ├── d_I128x128x3CMCMCMCMCMCMC1AS.md │ │ ├── d_I160x160x3CMCMBMBMBMBMB1AS.md │ │ ├── d_I160x160x3CMCMBMBMBMBMC1AS.md │ │ ├── d_I160x160x3CMCMCMCMCMCMC1AS.md │ │ ├── d_I192x192x3CMCMBMBMBMBMB1AS.md │ │ ├── d_I192x192x3CMCMBMBMBMBMC1AS.md │ │ ├── d_I192x192x3CMCMCMCMCMCMC1AS.md │ │ ├── d_I224x224x3CMBMBMBMBMBMC1AS.md │ │ ├── d_I224x224x3CMCMBMBMBMBMB1AS.md │ │ ├── d_I224x224x3CMCMBMBMBMBMC1AS.md │ │ ├── d_I224x224x3CMCMCMCMCMCMC1AS.md │ │ ├── d_I256x256x3CMBMBMBMBMBMB1AS.md │ │ ├── d_I256x256x3CMBMBMBMBMBMC1AS.md │ │ ├── d_I256x256x3CMCMBMBMBMBMB1AS.md │ │ ├── d_I256x256x3CMCMBMBMBMBMC1AS.md │ │ ├── d_I256x256x3CMCMCMCMCMCMC1AS.md │ │ ├── d_I256x256x3CMCMCMCMCMCMCMC1AS.md │ │ ├── dcda_I64x64x3CMCMCMCMCMC1AS.md │ │ ├── dcda_I64x64x3CMCMCMCMCMC1AS_v2.md │ │ ├── dcda_I64x64x3CMCMCMCMCMC1AS_v3.md │ │ ├── dcda_I64x64x3CMCMCMCMCMC1AS_v4.md │ │ ├── dcda_I64x64x3CMCMCMCMCMC1AS_v5.md │ │ ├── dcda_I64x64x3CMCMCMCMCMC1AS_v6.md │ │ ├── ddcs2_I128x128x3CCCCCCCCCCCCCC1AS.md │ │ ├── dr_19A_I128x128x3CMCMCMCMCMCMC1AS.md │ │ ├── dr_19A_I128x128x3CMCMCMCMCMCMC1AS_v2.md │ │ ├── dr_19B2_I128x128x3CMCMCMCMCMCMC1AS.md │ │ ├── dr_19C_I128x128x3CMCMCMCMCMCMC1AS.md │ │ ├── dr_19_I128x128x3CMCMCMCMCMCMC1AS.md │ │ ├── dr_19_I64x64x3CMCMCMCMCMC1AS.md │ │ ├── dr_313B_I256x256x3CMCMCMCMCMCMCMC1AS.md │ │ ├── dr_313C_I256x256x3CMCMCMCMCMCMCMC1AS.md │ │ ├── dr_313_I256x256x3CMCMCMCMCMCMCMC1AS.md │ │ ├── dr_I256x256x3CMCMCMCMCMCMCMC1AS.md │ │ ├── dr_cD_313_2X_I256x256x3CMCMCMCMCMCMCMC1AS.md │ │ ├── dr_cD_313_2X_I256x256x3CMCMCMCMCMCMCMC1AS_v2.md │ │ ├── dr_c_I256x256x3CMCMCMCMCMCMCMC1AS.md │ │ ├── dr_c_I256x256x3CMCMCMCMCMCMCMC1AS_v2.md │ │ ├── dr_c_I256x256x3CMCMCMCMCMCMCMC1AS_v3.md │ │ ├── dr_c_I256x256x3CMCMCMCMCMCMCMC1AS_v4.md │ │ ├── dr_c_I256x256x3CMCMCMCMCMCMCMC1AS_v5.md │ │ ├── dsb_I128x128x3CMCMCMCMCMCCCMC1AS.md │ │ ├── dsb_I64x64x3CMCMCMCMCCCMC1AS.md │ │ ├── dscs2_I128x128x3CCCCCCC1AS.md │ │ ├── dsf_I128x128x3CCMCCMCCMCMCMCMC1AS.md │ │ ├── dsf_I64x64x3CCMCCMCCMCMCMC1AS.md │ │ ├── dst_I128x128x3CCCMCMCMCMCMCMC1AS.md │ │ ├── dst_I64x64x3CCCMCMCMCMCMC1AS.md │ │ ├── index.md │ │ ├── orphaned │ │ │ ├── d_I160x160x3NCMNCMNBMNBMNBMNBMNB1A.md │ │ │ ├── dr_I256x256x3CMCMCMCMCMCMCMC1AS_v2.md │ │ │ └── dr_I256x256x3CMCMCMCMCMCMCMC1AS_v3.md │ │ ├── v_I160x160x3CCMCCMCCCMCCCMCCCMF2048S.md │ │ ├── v_I160x160x3CCMCCMCCCMCCCMCCCMF4096S.md │ │ ├── v_I192x192x3CCMCCMCCCMCCCMCCCMF1024F1024S.md │ │ ├── v_I64x64x3CCMCCMCCCCMCCCCMCCCCMF2048S.md │ │ ├── v_I64x64x3CCMCCMCCCMCCCMCCCMF2048S.md │ │ ├── v_I64x64x3CCMCCMCCMCCMCCMF4096S.md │ │ └── v_I64x64x3CCMCCMCMCMCMF3072S.md │ ├── Raspberry-Pi-3-Fan-Mount │ │ ├── Raspberry-Pi-3-Fan-Mount-With-Offsets.jpg │ │ ├── Raspberry-Pi-3-Fan-Mount-With-Offsets.stl │ │ ├── Raspberry-Pi-3-Fan-Mount-Without-Offsets.jpg │ │ ├── Raspberry-Pi-3-Fan-Mount-Without-Offsets.stl │ │ └── index.md │ ├── index.md │ └── speech_commands_v0.01 │ │ ├── index.md │ │ └── pareto.json ├── index.md ├── js │ ├── data.js │ └── multi-line-plot.js └── tutorials │ ├── Active-cooling-your-Raspberry-Pi-3 │ ├── Attach-Fan-to-Mount.jpg │ ├── Cluster.jpg │ ├── Pi-3-IR.jpg │ ├── Pi-Active-Cooling-Materials.jpg │ ├── Pi-Heating-Data.tsv │ ├── Pi-with-Fan-on-Display.jpg │ ├── Pi-with-Fan.jpg │ ├── Two-Mount-Designs.jpg │ ├── index.md │ └── pi-heating-data-long.tsv │ ├── Boosting-classifier-accuracy-by-grouping-categories │ ├── Screenshot.jpg │ ├── cats.txt │ ├── dogs.txt │ ├── index.md │ ├── pets.py │ ├── pets_callback.py │ └── thumbnail.png │ ├── Comparing-image-classification-models-side-by-side-on-the-Raspberry-Pi │ ├── Screenshot.jpg │ ├── index.md │ └── side_by_side.py │ ├── Getting-started-with-audio-keyword-spotting-on-the-Raspberry-Pi │ ├── index.md │ ├── seven.wav │ └── spectrogram.png │ ├── Getting-started-with-image-classification-in-cpp │ ├── CMakeLists.txt │ ├── Screenshot.png │ ├── index.md │ ├── tutorial.cpp │ └── tutorialHelpers.h │ ├── Getting-started-with-image-classification-on-the-Raspberry-Pi │ ├── Screenshot.jpg │ ├── call_model.py │ ├── index.md │ └── tutorial.py │ ├── Getting-started-with-object-detection-using-region-of-interest-networks │ ├── Screenshot.png │ ├── index.md │ └── tutorial.py │ ├── Importing-models │ └── index.md │ ├── Notes-on-playing-audio │ └── index.md │ ├── Raspberry-Pi-setup │ └── index.md │ ├── Repurposing-a-pretrained-image-classifier │ ├── Screenshot.jpg │ ├── figure1.svg │ ├── index.md │ └── retarget_validation.py │ ├── StyleGuide.md │ ├── Training-audio-keyword-spotter-with-pytorch │ ├── GRUKeywordSpotter.png │ ├── bad_list.txt │ ├── featurizer.png │ ├── index.md │ ├── process.jpg │ └── vad.png │ ├── index.md │ ├── shared │ ├── coffeemug.jpg │ └── tutorial_helpers.py │ └── tutorial_template.md ├── examples ├── CMakeLists.txt ├── README.md ├── data │ ├── CMakeLists.txt │ ├── bed.wav │ ├── makeTestData.py │ ├── protonnTestData.txt │ ├── seven.wav │ ├── testData.txt │ └── tinyTestData.txt └── python │ ├── CMakeLists.txt │ ├── run.bat │ ├── run.sh │ └── sgd.py ├── external └── packages.config ├── interfaces ├── CMakeLists.txt ├── R │ └── CMakeLists.txt ├── README.md ├── common │ ├── CMakeLists.txt │ ├── ELL_javascript_post.i │ ├── ELL_javascript_pre.i │ ├── ELL_python_post.i │ ├── ELL_python_pre.i │ ├── callback.i │ ├── callback_javascript_post.i │ ├── callback_javascript_pre.i │ ├── callback_python_post.i │ ├── callback_python_pre.i │ ├── common.i │ ├── dataset.i │ ├── doc │ │ ├── CallbackDesign.dgml │ │ ├── CallbackDesign.md │ │ └── CallbackDesign.png │ ├── ell.i │ ├── ell_py.i │ ├── evaluators.i │ ├── functions.i │ ├── include │ │ ├── CallbackInterface.h │ │ ├── DatasetInterface.h │ │ ├── DatasetInterfaceImpl.h │ │ ├── MathInterface.h │ │ ├── MatrixMatrixMultiplyImplementation.h │ │ ├── ModelBuilderInterface.h │ │ ├── ModelInterface.h │ │ ├── NeuralLayersInterface.h │ │ ├── NeuralNetworkPredictorInterface.h │ │ ├── Ports.h │ │ └── TrainerInterface.h │ ├── loadDatasetAsync.i │ ├── loadModelAsync.i │ ├── macros.i │ ├── math.i │ ├── math_javascript_post.i │ ├── math_javascript_pre.i │ ├── math_python_post.i │ ├── math_python_pre.i │ ├── model.i │ ├── model_javascript_post.i │ ├── model_python_post.i │ ├── nodes.i │ ├── noncopyable.i │ ├── predictors.i │ ├── predictors_javascript_post.i │ ├── predictors_javascript_pre.i │ ├── predictors_python_post.i │ ├── predictors_python_pre.i │ ├── shape.i │ ├── src │ │ ├── DatasetInterface.cpp │ │ ├── ModelBuilderInterface.cpp │ │ ├── ModelInterface.cpp │ │ ├── NeuralNetworkPredictorInterface.cpp │ │ ├── Ports.cpp │ │ └── TrainerInterface.cpp │ ├── trainers.i │ ├── unique_ptr.i │ ├── utilities.i │ ├── vector.i │ ├── vector_javascript_post.i │ ├── vector_javascript_pre.i │ ├── vector_python_post.i │ └── vector_python_pre.i ├── csharp │ └── CMakeLists.txt ├── javascript │ ├── CMakeLists.txt │ ├── ell_module │ │ ├── CMakeLists.txt │ │ ├── copyWindowsTestLib.cmd │ │ ├── templates │ │ │ ├── README.md │ │ │ ├── binding.gyp │ │ │ ├── buildme │ │ │ ├── buildme.cmd │ │ │ ├── copyLinuxLib.sh │ │ │ ├── copyMacLib.sh │ │ │ ├── copyWindowsLib.cmd │ │ │ ├── ell_manual.d.ts │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── package.json │ │ └── test │ │ │ ├── data │ │ │ └── testData.txt │ │ │ └── js │ │ │ ├── GetDatasetAsync.js │ │ │ ├── LoadModelAsync.js │ │ │ ├── TestCompiler.js │ │ │ ├── TrainersAsync.js │ │ │ └── package.json │ └── swigToTypescript │ │ ├── CMakeLists.txt │ │ └── templates │ │ ├── generate-d-ts.xslt │ │ ├── index.js │ │ └── package.json ├── python │ ├── CMakeLists.txt │ ├── package │ │ ├── CMakeLists.txt │ │ ├── MANIFEST.in │ │ ├── bld.bat │ │ ├── build.sh │ │ ├── ell │ │ │ ├── CMakeLists.txt │ │ │ ├── __init__.py │ │ │ ├── data │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── __init__.py │ │ │ ├── math │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── __init__.py │ │ │ ├── model │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── __init__.py │ │ │ ├── neural │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── __init__.py │ │ │ │ └── utilities.py │ │ │ ├── nodes │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── __init__.py │ │ │ ├── platform.py │ │ │ ├── rpi_magic.py │ │ │ ├── trainers │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── __init__.py │ │ │ ├── util │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── __init__.py │ │ │ │ ├── choose_subset.py │ │ │ │ ├── condabuildtools.py │ │ │ │ ├── gallery.py │ │ │ │ └── pretrained_model.py │ │ │ └── vision │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── __init__.py │ │ ├── meta.yaml │ │ ├── readme.md │ │ └── setup.py │ └── test │ │ ├── CMakeLists.txt │ │ ├── common_test.py │ │ ├── compiled_model_test.py │ │ ├── dataset_test.py │ │ ├── ell_helper.py │ │ ├── evaluators_test.py │ │ ├── functions_test.py │ │ ├── linear_test.py │ │ ├── model_test.py │ │ ├── modelbuilder_test.py │ │ ├── nodes_test.py │ │ ├── predictors_test.py │ │ ├── protonnTestData.bc │ │ ├── protonnTestData.ell │ │ ├── protonn_trainer_test.py │ │ ├── sgd_trainer_test.py │ │ ├── test.py │ │ ├── testing.py │ │ ├── trainers_test.py │ │ └── vector_test.py └── xml │ └── CMakeLists.txt ├── libraries ├── CMakeLists.txt ├── common │ ├── CMakeLists.txt │ ├── include │ │ ├── AppendNodeToModel.h │ │ ├── DataLoadArguments.h │ │ ├── DataLoaders.h │ │ ├── DataSaveArguments.h │ │ ├── EvaluatorArguments.h │ │ ├── ForestTrainerArguments.h │ │ ├── LoadModel.h │ │ ├── MakeEvaluator.h │ │ ├── MakeTrainer.h │ │ ├── MapCompilerArguments.h │ │ ├── MapLoadArguments.h │ │ ├── MapSaveArguments.h │ │ ├── ModelLoadArguments.h │ │ ├── ModelSaveArguments.h │ │ ├── ParametersEnumerator.h │ │ ├── ProtoNNTrainerArguments.h │ │ ├── RegisterNodeCreators.h │ │ └── TrainerArguments.h │ ├── src │ │ ├── DataLoadArguments.cpp │ │ ├── DataLoaders.cpp │ │ ├── DataSaveArguments.cpp │ │ ├── EvaluatorArguments.cpp │ │ ├── ForestTrainerArguments.cpp │ │ ├── LoadModel.cpp │ │ ├── MakeTrainer.cpp │ │ ├── MapCompilerArguments.cpp │ │ ├── MapLoadArguments.cpp │ │ ├── MapSaveArguments.cpp │ │ ├── ModelLoadArguments.cpp │ │ ├── ModelSaveArguments.cpp │ │ ├── ProtoNNTrainerArguments.cpp │ │ ├── RegisterNodeCreators.cpp │ │ └── TrainerArguments.cpp │ └── test │ │ ├── include │ │ ├── LoadDataset_test.h │ │ ├── LoadMap_test.h │ │ ├── LoadModel_test.h │ │ └── LoadTestModels.h │ │ └── src │ │ ├── LoadDataset_test.cpp │ │ ├── LoadMap_test.cpp │ │ ├── LoadModel_test.cpp │ │ ├── LoadTestModels.cpp │ │ └── main.cpp ├── data │ ├── CMakeLists.txt │ ├── doc │ │ ├── GeneralizedSparseFormat.md │ │ └── README.md │ ├── include │ │ ├── AutoDataVector.h │ │ ├── DataVector.h │ │ ├── DataVectorOperations.h │ │ ├── Dataset.h │ │ ├── DenseDataVector.h │ │ ├── Example.h │ │ ├── ExampleIterator.h │ │ ├── GeneralizedSparseParsingIterator.h │ │ ├── IndexValue.h │ │ ├── SequentialLineIterator.h │ │ ├── SingleLineParsingExampleIterator.h │ │ ├── SparseBinaryDataVector.h │ │ ├── SparseDataVector.h │ │ ├── StlIndexValueIterator.h │ │ ├── TextLine.h │ │ ├── TransformedDataVector.h │ │ ├── TransformingIndexValueIterator.h │ │ ├── WeightClassIndex.h │ │ └── WeightLabel.h │ ├── src │ │ ├── DataVector.cpp │ │ ├── DataVectorOperations.cpp │ │ ├── Dataset.cpp │ │ ├── DenseDataVector.cpp │ │ ├── GeneralizedSparseParsingIterator.cpp │ │ ├── SequentialLineIterator.cpp │ │ ├── SparseDataVector.cpp │ │ ├── TextLine.cpp │ │ ├── WeightClassIndex.cpp │ │ └── WeightLabel.cpp │ └── test │ │ ├── include │ │ ├── DataVector_test.h │ │ ├── Dataset_test.h │ │ ├── Example_test.h │ │ └── Parser_test.h │ │ └── src │ │ ├── DataVector_test.cpp │ │ ├── Dataset_test.cpp │ │ ├── Example_test.cpp │ │ ├── Parser_test.cpp │ │ └── main.cpp ├── dsp │ ├── CMakeLists.txt │ ├── include │ │ ├── Convolution.h │ │ ├── DCT.h │ │ ├── FFT.h │ │ ├── FilterBank.h │ │ ├── IIRFilter.h │ │ ├── SimpleConvolution.h │ │ ├── UnrolledConvolution.h │ │ ├── WindowFunctions.h │ │ └── WinogradConvolution.h │ ├── py │ │ ├── symbolic.py │ │ └── winograd.py │ ├── src │ │ ├── Convolution.cpp │ │ ├── FilterBank.cpp │ │ ├── SimpleConvolution.cpp │ │ ├── UnrolledConvolution.cpp │ │ └── WinogradConvolution.cpp │ └── test │ │ ├── include │ │ ├── CepstrumTestData.h │ │ ├── ConvolutionTest.h │ │ ├── ConvolutionTestData.h │ │ ├── ConvolutionTiming.h │ │ ├── DCTTest.h │ │ ├── DSPTestData.h │ │ ├── DSPTestUtilities.h │ │ ├── FFTTest.h │ │ ├── FilterTest.h │ │ ├── MelTest.h │ │ └── WindowTest.h │ │ ├── py │ │ └── generate_test_data.py │ │ └── src │ │ ├── CepstrumTestData.cpp │ │ ├── ConvolutionTest.cpp │ │ ├── ConvolutionTestData.cpp │ │ ├── ConvolutionTiming.cpp │ │ ├── DCTTest.cpp │ │ ├── DSPTestData.cpp │ │ ├── DSPTestUtilities.cpp │ │ ├── FFTTest.cpp │ │ ├── FilterTest.cpp │ │ ├── MelTest.cpp │ │ ├── VadData.txt │ │ ├── WindowTest.cpp │ │ ├── main.cpp │ │ └── timing_main.cpp ├── emittable_functions │ ├── CMakeLists.txt │ ├── include │ │ ├── Convolutions.h │ │ ├── IIRFilter.h │ │ ├── LogisticFunctions.h │ │ └── VoiceActivityDetector.h │ ├── src │ │ ├── Convolutions.cpp │ │ ├── IIRFilter.cpp │ │ ├── LogisticFunctions.cpp │ │ └── VoiceActivityDetector.cpp │ └── test │ │ ├── include │ │ ├── Convolutions_test.h │ │ ├── Emittable_functions_util.h │ │ ├── IIRFilter_test.h │ │ ├── LogisticFunctionsTest.h │ │ └── VoiceActivityDetectorTest.h │ │ └── src │ │ ├── Convolutions_test.cpp │ │ ├── Emittable_functions_util.cpp │ │ ├── IIRFilter_test.cpp │ │ ├── LogisticFunctionsTest.cpp │ │ ├── VadData.txt │ │ ├── VoiceActivityDetectorTest.cpp │ │ └── main.cpp ├── emitters │ ├── CMakeLists.txt │ ├── doc │ │ ├── PosixRuntimeNotes.md │ │ └── ThreadPoolDesign.md │ ├── include │ │ ├── CompilableFunction.h │ │ ├── CompilerOptions.h │ │ ├── EmitterException.h │ │ ├── EmitterTypes.h │ │ ├── FunctionDeclaration.h │ │ ├── IRAssemblyWriter.h │ │ ├── IRAsyncTask.h │ │ ├── IRBlockRegion.h │ │ ├── IRDiagnosticHandler.h │ │ ├── IREmitter.h │ │ ├── IRExecutionEngine.h │ │ ├── IRFunctionEmitter.h │ │ ├── IRHeaderWriter.h │ │ ├── IRIfEmitter.h │ │ ├── IRLoader.h │ │ ├── IRLocalArray.h │ │ ├── IRLocalMultidimArray.h │ │ ├── IRLocalScalar.h │ │ ├── IRLocalValue.h │ │ ├── IRLoopEmitter.h │ │ ├── IRMath.h │ │ ├── IRMetadata.h │ │ ├── IRModuleEmitter.h │ │ ├── IROptimizer.h │ │ ├── IRParallelLoopEmitter.h │ │ ├── IRPosixRuntime.h │ │ ├── IRProfiler.h │ │ ├── IRRuntime.h │ │ ├── IRSwigInterfaceWriter.h │ │ ├── IRTask.h │ │ ├── IRThreadPool.h │ │ ├── IRThreadUtilities.h │ │ ├── IRVectorUtilities.h │ │ ├── LLVMInclude.h │ │ ├── LLVMUtilities.h │ │ ├── ModuleEmitter.h │ │ ├── ScalarVariable.h │ │ ├── SymbolTable.h │ │ ├── TargetDevice.h │ │ ├── Variable.h │ │ └── VectorVariable.h │ ├── src │ │ ├── CompilerOptions.cpp │ │ ├── EmitterTypes.cpp │ │ ├── IRAssemblyWriter.cpp │ │ ├── IRAsyncTask.cpp │ │ ├── IRBlockRegion.cpp │ │ ├── IRDiagnosticHandler.cpp │ │ ├── IREmitter.cpp │ │ ├── IRExecutionEngine.cpp │ │ ├── IRFunctionEmitter.cpp │ │ ├── IRHeaderWriter.cpp │ │ ├── IRIfEmitter.cpp │ │ ├── IRLoader.cpp │ │ ├── IRLocalArray.cpp │ │ ├── IRLocalMultidimArray.cpp │ │ ├── IRLocalScalar.cpp │ │ ├── IRLocalValue.cpp │ │ ├── IRLoopEmitter.cpp │ │ ├── IRMath.cpp │ │ ├── IRMetadata.cpp │ │ ├── IRModuleEmitter.cpp │ │ ├── IROptimizer.cpp │ │ ├── IRParallelLoopEmitter.cpp │ │ ├── IRPosixRuntime.cpp │ │ ├── IRProfiler.cpp │ │ ├── IRRuntime.cpp │ │ ├── IRSwigInterfaceWriter.cpp │ │ ├── IRTask.cpp │ │ ├── IRThreadPool.cpp │ │ ├── IRThreadUtilities.cpp │ │ ├── LLVMUtilities.cpp │ │ ├── ModuleEmitter.cpp │ │ ├── TargetDevice.cpp │ │ └── Variable.cpp │ ├── templates │ │ ├── CppPredictWrapper.in │ │ ├── LLVMEmitterTargets.h.in │ │ ├── SwigModule.in │ │ ├── SwigPredictPython.in │ │ └── SwigShapeWrappers.in │ └── test │ │ ├── include │ │ ├── AsyncEmitterTest.h │ │ ├── IREmitterTest.h │ │ ├── IRFunctionTest.h │ │ ├── IRProfilerTest.h │ │ ├── PosixEmitterTest.h │ │ └── StdlibEmitterTest.h │ │ └── src │ │ ├── AsyncEmitterTest.cpp │ │ ├── IREmitterTest.cpp │ │ ├── IRFunctionTest.cpp │ │ ├── IRProfilerTest.cpp │ │ ├── PosixEmitterTest.cpp │ │ ├── StdlibEmitterTest.cpp │ │ └── main.cpp ├── evaluators │ ├── CMakeLists.txt │ ├── include │ │ ├── AUCAggregator.h │ │ ├── BinaryErrorAggregator.h │ │ ├── Evaluator.h │ │ ├── IncrementalEvaluator.h │ │ └── LossAggregator.h │ ├── src │ │ ├── AUCAggregator.cpp │ │ └── BinaryErrorAggregator.cpp │ └── test │ │ ├── include │ │ └── Evaluators_test.h │ │ └── src │ │ ├── Evaluators_test.cpp │ │ └── main.cpp ├── functions │ ├── CMakeLists.txt │ ├── include │ │ ├── ElasticNetRegularizer.h │ │ ├── HingeLoss.h │ │ ├── L2Regularizer.h │ │ ├── LogLoss.h │ │ ├── SmoothHingeLoss.h │ │ └── SquaredLoss.h │ ├── src │ │ ├── ElasticNetRegularizer.cpp │ │ ├── HingeLoss.cpp │ │ ├── L2Regularizer.cpp │ │ ├── LogLoss.cpp │ │ ├── SmoothHingeLoss.cpp │ │ └── SquaredLoss.cpp │ └── test │ │ └── src │ │ └── main.cpp ├── math │ ├── CMakeLists.txt │ ├── doc │ │ └── README.md │ ├── include │ │ ├── BlasWrapper.h │ │ ├── Common.h │ │ ├── MathConstants.h │ │ ├── Matrix.h │ │ ├── MatrixOperations.h │ │ ├── Tensor.h │ │ ├── TensorOperations.h │ │ ├── Transformations.h │ │ ├── Vector.h │ │ └── VectorOperations.h │ ├── src │ │ ├── BlasWrapper.cpp │ │ └── Tensor.cpp │ └── test │ │ ├── include │ │ ├── Matrix_test.h │ │ ├── Tensor_test.h │ │ ├── Vector_test.h │ │ └── math_profile.h │ │ └── src │ │ ├── main.cpp │ │ └── math_profile_main.cpp ├── model │ ├── CMakeLists.txt │ ├── doc │ │ ├── CompileAsFunction.md │ │ ├── Metadata.md │ │ └── README.md │ ├── include │ │ ├── CompilableCodeNode.h │ │ ├── CompilableNode.h │ │ ├── CompilableNodeUtilities.h │ │ ├── CompiledMap.h │ │ ├── IRCompiledMap.h │ │ ├── IRMapCompiler.h │ │ ├── IRModelProfiler.h │ │ ├── InputNode.h │ │ ├── InputNodeBase.h │ │ ├── InputPort.h │ │ ├── Map.h │ │ ├── MapCompiler.h │ │ ├── MapCompilerOptions.h │ │ ├── Model.h │ │ ├── ModelBuilder.h │ │ ├── ModelEditor.h │ │ ├── ModelOptimizerOptions.h │ │ ├── ModelTransformer.h │ │ ├── Node.h │ │ ├── NodeMap.h │ │ ├── OptimizeModelTransformation.h │ │ ├── OutputNode.h │ │ ├── OutputNodeBase.h │ │ ├── OutputPort.h │ │ ├── Port.h │ │ ├── PortElements.h │ │ ├── PortMemoryLayout.h │ │ ├── RefineAndOptimizeTransformation.h │ │ ├── RefineTransformation.h │ │ ├── SetCompilerOptionsTransformation.h │ │ ├── SliceNode.h │ │ ├── SpliceNode.h │ │ ├── Submodel.h │ │ ├── TransformContext.h │ │ ├── Transformation.h │ │ └── TransformationRegistry.h │ ├── optimizer │ │ └── test │ │ │ ├── include │ │ │ ├── Cost.h │ │ │ ├── CostDatabase.h │ │ │ ├── CostModel.h │ │ │ ├── CostModelTest.h │ │ │ ├── CostTest.h │ │ │ ├── Environment.h │ │ │ ├── EnvironmentTest.h │ │ │ ├── ExampleCostModels.h │ │ │ ├── ExampleObjectives.h │ │ │ ├── ExampleOptimizers.h │ │ │ ├── ExampleTransformations.h │ │ │ ├── GlobalOptimizer.h │ │ │ ├── GlobalOptimizerOptions.h │ │ │ ├── Objective.h │ │ │ ├── ObjectiveTest.h │ │ │ ├── OptimizerOptionsTest.h │ │ │ ├── OptimizerTest.h │ │ │ ├── OptimizerTestUtil.h │ │ │ ├── SequentialOptimizer.h │ │ │ └── TransformationTest.h │ │ │ └── src │ │ │ ├── Cost.cpp │ │ │ ├── CostDatabase.cpp │ │ │ ├── CostModelTest.cpp │ │ │ ├── CostTest.cpp │ │ │ ├── Environment.cpp │ │ │ ├── EnvironmentTest.cpp │ │ │ ├── ExampleCostModels.cpp │ │ │ ├── ExampleObjectives.cpp │ │ │ ├── ExampleOptimizers.cpp │ │ │ ├── ExampleTransformations.cpp │ │ │ ├── GlobalOptimizer.cpp │ │ │ ├── GlobalOptimizerOptions.cpp │ │ │ ├── ObjectiveTest.cpp │ │ │ ├── OptimizerOptionsTest.cpp │ │ │ ├── OptimizerTest.cpp │ │ │ ├── OptimizerTestUtil.cpp │ │ │ ├── SequentialOptimizer.cpp │ │ │ ├── TransformationTest.cpp │ │ │ └── main.cpp │ ├── src │ │ ├── CompilableCodeNode.cpp │ │ ├── CompilableNode.cpp │ │ ├── CompilableNodeUtilities.cpp │ │ ├── CompiledMap.cpp │ │ ├── IRCompiledMap.cpp │ │ ├── IRMapCompiler.cpp │ │ ├── IRModelProfiler.cpp │ │ ├── InputNodeBase.cpp │ │ ├── InputPort.cpp │ │ ├── Map.cpp │ │ ├── MapCompiler.cpp │ │ ├── MapCompilerOptions.cpp │ │ ├── Model.cpp │ │ ├── ModelBuilder.cpp │ │ ├── ModelEditor.cpp │ │ ├── ModelOptimizerOptions.cpp │ │ ├── ModelTransformer.cpp │ │ ├── Node.cpp │ │ ├── OptimizeModelTransformation.cpp │ │ ├── OutputNodeBase.cpp │ │ ├── OutputPort.cpp │ │ ├── Port.cpp │ │ ├── PortElements.cpp │ │ ├── PortMemoryLayout.cpp │ │ ├── RefineAndOptimizeTransformation.cpp │ │ ├── RefineTransformation.cpp │ │ ├── SetCompilerOptionsTransformation.cpp │ │ ├── Submodel.cpp │ │ ├── TransformContext.cpp │ │ ├── Transformation.cpp │ │ └── TransformationRegistry.cpp │ └── test │ │ ├── clang │ │ ├── DotProduct.cpp │ │ ├── DotProduct.ll │ │ ├── DotProductIR.h │ │ ├── clang-options.md │ │ ├── generateIR.cmd │ │ └── generateIR.sh │ │ ├── include │ │ ├── CompilableCodeNode_test.h │ │ ├── CompilableNodesTest.h │ │ ├── CompilerTest.h │ │ ├── Map_test.h │ │ ├── Metadata_test.h │ │ ├── ModelBuilder_test.h │ │ ├── ModelHeaderOutputTest.h │ │ ├── ModelOptimizerOptions_test.h │ │ ├── ModelTransformerTest.h │ │ ├── Model_test.h │ │ ├── PerformanceCountersTest.h │ │ ├── PortElements_test.h │ │ └── Submodel_test.h │ │ └── src │ │ ├── CompilableCodeNode_test.cpp │ │ ├── CompilableNodesTest.cpp │ │ ├── CompilerTest.cpp │ │ ├── Map_test.cpp │ │ ├── Metadata_test.cpp │ │ ├── ModelBuilder_test.cpp │ │ ├── ModelHeaderOutputTest.cpp │ │ ├── ModelOptimizerOptions_test.cpp │ │ ├── ModelTransformerTest.cpp │ │ ├── Model_test.cpp │ │ ├── PerformanceCountersTest.cpp │ │ ├── PortElements_test.cpp │ │ ├── Submodel_test.cpp │ │ ├── TestProtoNNPredictorMap_LabelEmbeddings.inc │ │ ├── TestProtoNNPredictorMap_Projection.inc │ │ ├── TestProtoNNPredictorMap_Prototypes.inc │ │ ├── TestProtoNNPredictorMap_features.inc │ │ ├── TestRegionDetectionNode_expectedOutput.inc │ │ ├── TestRegionDetectionNode_input.inc │ │ ├── main.cpp │ │ └── model_compiler_test_main.cpp ├── model_testing │ ├── CMakeLists.txt │ ├── include │ │ └── ModelTestUtilities.h │ └── src │ │ └── ModelTestUtilities.cpp ├── nodes │ ├── CMakeLists.txt │ ├── include │ │ ├── AccumulatorNode.h │ │ ├── ActivationFunctions.h │ │ ├── ActivationLayerNode.h │ │ ├── BatchNormalizationLayerNode.h │ │ ├── BiasLayerNode.h │ │ ├── BinaryConvolutionalLayerNode.h │ │ ├── BinaryFunctionNode.h │ │ ├── BinaryOperationNode.h │ │ ├── BinaryPredicateNode.h │ │ ├── BroadcastFunctionNode.h │ │ ├── BroadcastOperationNodes.h │ │ ├── BufferNode.h │ │ ├── ClockNode.h │ │ ├── ConcatenationNode.h │ │ ├── ConstantNode.h │ │ ├── ConvolutionalLayerNode.h │ │ ├── DCTNode.h │ │ ├── DTWDistanceNode.h │ │ ├── DebugSinkNode.h │ │ ├── DelayNode.h │ │ ├── DemultiplexerNode.h │ │ ├── DiagonalConvolutionNode.h │ │ ├── DotProductNode.h │ │ ├── ExtremalValueNode.h │ │ ├── FFTNode.h │ │ ├── FastGRNNNode.h │ │ ├── FilterBankNode.h │ │ ├── ForestPredictorNode.h │ │ ├── FullyConnectedLayerNode.h │ │ ├── GRUNode.h │ │ ├── HammingWindowNode.h │ │ ├── HannWindowNode.h │ │ ├── IIRFilterNode.h │ │ ├── IRNode.h │ │ ├── L2NormSquaredNode.h │ │ ├── LSTMNode.h │ │ ├── LinearPredictorNode.h │ │ ├── MatrixMatrixMultiplyCodeNode.h │ │ ├── MatrixMatrixMultiplyImplementation.h │ │ ├── MatrixMatrixMultiplyNode.h │ │ ├── MatrixVectorMultiplyNode.h │ │ ├── MatrixVectorProductNode.h │ │ ├── MovingAverageNode.h │ │ ├── MovingVarianceNode.h │ │ ├── MultiplexerNode.h │ │ ├── NeuralNetworkLayerNode.h │ │ ├── NeuralNetworkPredictorNode.h │ │ ├── NodeOperations.h │ │ ├── PoolingLayerNode.h │ │ ├── ProtoNNPredictorNode.h │ │ ├── RNNNode.h │ │ ├── ReceptiveFieldMatrixNode.h │ │ ├── RecurrentLayerNode.h │ │ ├── RegionDetectionLayerNode.h │ │ ├── ReinterpretLayoutNode.h │ │ ├── ReorderDataCodeNode.h │ │ ├── ReorderDataNode.h │ │ ├── ScalingLayerNode.h │ │ ├── ScalingNode.h │ │ ├── SimpleConvolutionNode.h │ │ ├── SingleElementThresholdNode.h │ │ ├── SinkNode.h │ │ ├── SoftmaxLayerNode.h │ │ ├── SourceNode.h │ │ ├── SpatialConvolutionNode.h │ │ ├── SquaredEuclideanDistanceNode.h │ │ ├── SumNode.h │ │ ├── TypeCastNode.h │ │ ├── UnaryOperationNode.h │ │ ├── UnrolledConvolutionNode.h │ │ ├── ValueSelectorNode.h │ │ ├── VoiceActivityDetectorNode.h │ │ └── WinogradConvolutionNode.h │ ├── src │ │ ├── ActivationFunctions.cpp │ │ ├── ActivationLayerNode.cpp │ │ ├── BatchNormalizationLayerNode.cpp │ │ ├── BiasLayerNode.cpp │ │ ├── BinaryConvolutionalLayerNode.cpp │ │ ├── BroadcastOperationNodes.cpp │ │ ├── BufferNode.cpp │ │ ├── ClockNode.cpp │ │ ├── ConstantNode.cpp │ │ ├── ConvolutionalLayerNode.cpp │ │ ├── DCTNode.cpp │ │ ├── DiagonalConvolutionNode.cpp │ │ ├── FFTNode.cpp │ │ ├── FastGRNNNode.cpp │ │ ├── FilterBankNode.cpp │ │ ├── FullyConnectedLayerNode.cpp │ │ ├── GRUNode.cpp │ │ ├── IIRFilterNode.cpp │ │ ├── IRNode.cpp │ │ ├── LSTMNode.cpp │ │ ├── MatrixMatrixMultiplyCodeNode.cpp │ │ ├── MatrixMatrixMultiplyNode.cpp │ │ ├── MatrixVectorMultiplyNode.cpp │ │ ├── NeuralNetworkPredictorNode.cpp │ │ ├── PoolingLayerNode.cpp │ │ ├── ProtoNNPredictorNode.cpp │ │ ├── RNNNode.cpp │ │ ├── RegionDetectionLayerNode.cpp │ │ ├── ScalingLayerNode.cpp │ │ ├── ScalingNode.cpp │ │ ├── SimpleConvolutionNode.cpp │ │ ├── SingleElementThresholdNode.cpp │ │ ├── SoftmaxLayerNode.cpp │ │ ├── UnaryOperationNode.cpp │ │ ├── UnrolledConvolutionNode.cpp │ │ ├── VoiceActivityDetectorNode.cpp │ │ └── WinogradConvolutionNode.cpp │ └── test │ │ ├── include │ │ ├── AppendNodesTests.h │ │ ├── BasicMathNodesTests.h │ │ ├── DSPCodeNodesTests.h │ │ ├── DSPNodesTests.h │ │ ├── DSPNodesTiming.h │ │ ├── DTWPrototype.h │ │ ├── NeuralNetworkLayerNodesTests.h │ │ ├── NodesTestData.h │ │ ├── NodesTestUtilities.h │ │ └── NodesTests.h │ │ └── src │ │ ├── AppendNodesTests.cpp │ │ ├── BasicMathNodesTests.cpp │ │ ├── DSPCodeNodesTests.cpp │ │ ├── DSPNodesTest_main.cpp │ │ ├── DSPNodesTests.cpp │ │ ├── DSPNodesTiming.cpp │ │ ├── GenerateGRUTest.py │ │ ├── GenerateLSTMTest.py │ │ ├── GenerateRNNTest.py │ │ ├── NeuralNetworkLayerNodesTest_main.cpp │ │ ├── NeuralNetworkLayerNodesTests.cpp │ │ ├── NodesTestData.cpp │ │ ├── NodesTests.cpp │ │ ├── main.cpp │ │ └── timing_main.cpp ├── optimization │ ├── CMakeLists.txt │ ├── include │ │ ├── AbsoluteLoss.h │ │ ├── BinarySearch.h │ │ ├── Common.h │ │ ├── ElasticNetRegularizer.h │ │ ├── ExponentialSearch.h │ │ ├── Expression.h │ │ ├── GetSparseSolution.h │ │ ├── GoldenSectionSearch.h │ │ ├── HingeLoss.h │ │ ├── HuberLoss.h │ │ ├── IndexedContainer.h │ │ ├── Interval.h │ │ ├── L2Regularizer.h │ │ ├── LogisticLoss.h │ │ ├── MaskedMatrixSolution.h │ │ ├── MatrixDataset.h │ │ ├── MatrixSolution.h │ │ ├── MaxRegularizer.h │ │ ├── MultivariateLoss.h │ │ ├── NormProx.h │ │ ├── OptimizationExample.h │ │ ├── SDCAOptimizer.h │ │ ├── SGDOptimizer.h │ │ ├── SmoothedHingeLoss.h │ │ ├── SquareLoss.h │ │ ├── SquaredHingeLoss.h │ │ └── VectorSolution.h │ ├── src │ │ ├── Interval.cpp │ │ └── NormProx.cpp │ └── test │ │ ├── include │ │ ├── LossFunction_test.h │ │ ├── Optimizer_test.h │ │ ├── Other_test.h │ │ ├── RandomDataset.h │ │ ├── Regularizer_test.h │ │ ├── Search_test.h │ │ └── Solution_test.h │ │ └── src │ │ ├── Other_test.cpp │ │ ├── RandomDataset.cpp │ │ ├── Regularizer_test.cpp │ │ ├── Search_test.cpp │ │ └── main.cpp ├── passes │ ├── CMakeLists.txt │ ├── include │ │ ├── DetectLowPrecisionConvolutionTransformation.h │ │ ├── FuseLinearOperationsTransformation.h │ │ ├── OptimizeReorderDataNodesTransformation.h │ │ ├── SetConvolutionMethodTransformation.h │ │ └── StandardTransformations.h │ ├── src │ │ ├── DetectLowPrecisionConvolutionTransformation.cpp │ │ ├── FuseLinearOperationsTransformation.cpp │ │ ├── OptimizeReorderDataNodesTransformation.cpp │ │ ├── SetConvolutionMethodTransformation.cpp │ │ └── StandardTransformations.cpp │ └── test │ │ ├── include │ │ ├── ModelOptimizerTest.h │ │ └── TransformationTest.h │ │ └── src │ │ ├── ModelOptimizerTest.cpp │ │ ├── TransformationTest.cpp │ │ └── main.cpp ├── predictors │ ├── CMakeLists.txt │ ├── doc │ │ └── ProtoNNPredictor.md │ ├── include │ │ ├── ConstantPredictor.h │ │ ├── ForestPredictor.h │ │ ├── IPredictor.h │ │ ├── LinearPredictor.h │ │ ├── NeuralNetworkPredictor.h │ │ ├── Normalizer.h │ │ ├── ProtoNNPredictor.h │ │ ├── SignPredictor.h │ │ └── SingleElementThresholdPredictor.h │ ├── neural │ │ ├── include │ │ │ ├── Activation.h │ │ │ ├── ActivationLayer.h │ │ │ ├── BatchNormalizationLayer.h │ │ │ ├── BiasLayer.h │ │ │ ├── BinaryConvolutionalLayer.h │ │ │ ├── ConvolutionalLayer.h │ │ │ ├── FullyConnectedLayer.h │ │ │ ├── HardSigmoidActivation.h │ │ │ ├── HardTanhActivation.h │ │ │ ├── InputLayer.h │ │ │ ├── Layer.h │ │ │ ├── LeakyReLUActivation.h │ │ │ ├── MaxPoolingFunction.h │ │ │ ├── MeanPoolingFunction.h │ │ │ ├── ParametricReLUActivation.h │ │ │ ├── PoolingLayer.h │ │ │ ├── ReLUActivation.h │ │ │ ├── RegionDetectionLayer.h │ │ │ ├── ScalingLayer.h │ │ │ ├── SigmoidActivation.h │ │ │ ├── SoftMaxActivation.h │ │ │ ├── SoftmaxLayer.h │ │ │ └── TanhActivation.h │ │ └── src │ │ │ └── Activation.cpp │ ├── src │ │ ├── ConstantPredictor.cpp │ │ ├── ProtoNNPredictor.cpp │ │ └── SingleElementThresholdPredictor.cpp │ └── test │ │ ├── include │ │ ├── ForestPredictorTests.h │ │ ├── LinearPredictorTests.h │ │ ├── NeuralNetworkPredictorTests.h │ │ └── ProtoNNPredictorTests.h │ │ └── src │ │ ├── ForestPredictorTests.cpp │ │ ├── ProtoNNPredictorTests.cpp │ │ └── main.cpp ├── testing │ ├── CMakeLists.txt │ ├── include │ │ └── testing.h │ └── src │ │ └── testing.cpp ├── trainers │ ├── CMakeLists.txt │ ├── doc │ │ └── README.md │ ├── include │ │ ├── EvaluatingTrainer.h │ │ ├── ForestTrainer.h │ │ ├── HistogramForestTrainer.h │ │ ├── ITrainer.h │ │ ├── KMeansTrainer.h │ │ ├── LogitBooster.h │ │ ├── MeanCalculator.h │ │ ├── ProtoNNInit.h │ │ ├── ProtoNNModel.h │ │ ├── ProtoNNTrainer.h │ │ ├── ProtoNNTrainerUtils.h │ │ ├── SDCATrainer.h │ │ ├── SGDTrainer.h │ │ ├── SortingForestTrainer.h │ │ ├── SweepingTrainer.h │ │ └── ThresholdFinder.h │ ├── src │ │ ├── ForestTrainer.cpp │ │ ├── KMeansTrainer.cpp │ │ ├── LogitBooster.cpp │ │ ├── MeanCalculator.cpp │ │ ├── ProtoNNInit.cpp │ │ ├── ProtoNNTrainer.cpp │ │ ├── SGDTrainer.cpp │ │ └── ThresholdFinder.cpp │ └── test │ │ └── src │ │ └── main.cpp ├── utilities │ ├── CMakeLists.txt │ ├── doc │ │ ├── ArchiveVersionHistory.md │ │ └── ArchiveVersioning.md │ ├── include │ │ ├── AbstractInvoker.h │ │ ├── AnyIterator.h │ │ ├── ArchiveVersion.h │ │ ├── Archiver.h │ │ ├── Boolean.h │ │ ├── CStringParser.h │ │ ├── CallbackRegistry.h │ │ ├── CommandLineParser.h │ │ ├── CompressedIntegerList.h │ │ ├── Debug.h │ │ ├── EnumFlagHelpers.h │ │ ├── Exception.h │ │ ├── Files.h │ │ ├── Format.h │ │ ├── FunctionUtils.h │ │ ├── Graph.h │ │ ├── Hash.h │ │ ├── IArchivable.h │ │ ├── IIterator.h │ │ ├── IndentedTextWriter.h │ │ ├── IntegerList.h │ │ ├── IntegerNArray.h │ │ ├── IntegerStack.h │ │ ├── JsonArchiver.h │ │ ├── Logger.h │ │ ├── MemoryLayout.h │ │ ├── MillisecondTimer.h │ │ ├── ObjectArchive.h │ │ ├── ObjectArchiver.h │ │ ├── Optional.h │ │ ├── OutputStreamImpostor.h │ │ ├── PPMImageParser.h │ │ ├── ParallelTransformIterator.h │ │ ├── PropertyBag.h │ │ ├── RandomEngines.h │ │ ├── RingBuffer.h │ │ ├── StlContainerIterator.h │ │ ├── StlStridedIterator.h │ │ ├── StlVectorUtil.h │ │ ├── StringUtil.h │ │ ├── Tokenizer.h │ │ ├── TransformIterator.h │ │ ├── TunableParameters.h │ │ ├── TupleUtils.h │ │ ├── TypeAliases.h │ │ ├── TypeFactory.h │ │ ├── TypeName.h │ │ ├── TypeTraits.h │ │ ├── UniqueId.h │ │ ├── UniqueNameList.h │ │ ├── Unused.h │ │ ├── Variant.h │ │ ├── XmlArchiver.h │ │ └── ZipIterator.h │ ├── src │ │ ├── ArchiveVersion.cpp │ │ ├── Archiver.cpp │ │ ├── Boolean.cpp │ │ ├── CStringParser.cpp │ │ ├── CommandLineParser.cpp │ │ ├── CompressedIntegerList.cpp │ │ ├── Files.cpp │ │ ├── Format.cpp │ │ ├── Graph.cpp │ │ ├── IArchivable.cpp │ │ ├── IndentedTextWriter.cpp │ │ ├── IntegerList.cpp │ │ ├── IntegerStack.cpp │ │ ├── JsonArchiver.cpp │ │ ├── Logger.cpp │ │ ├── MemoryLayout.cpp │ │ ├── MillisecondTimer.cpp │ │ ├── ObjectArchive.cpp │ │ ├── ObjectArchiver.cpp │ │ ├── OutputStreamImpostor.cpp │ │ ├── PPMImageParser.cpp │ │ ├── PropertyBag.cpp │ │ ├── RandomEngines.cpp │ │ ├── StringUtil.cpp │ │ ├── Tokenizer.cpp │ │ ├── TypeName.cpp │ │ ├── UniqueId.cpp │ │ ├── UniqueNameList.cpp │ │ ├── Variant.cpp │ │ └── XmlArchiver.cpp │ └── test │ │ ├── include │ │ ├── Archiver_test.h │ │ ├── Files_test.h │ │ ├── Format_test.h │ │ ├── FunctionUtils_test.h │ │ ├── Hash_test.h │ │ ├── Iterator_test.h │ │ ├── MemoryLayout_test.h │ │ ├── ObjectArchive_test.h │ │ ├── PropertyBag_test.h │ │ ├── RingBuffer_test.h │ │ ├── TunableParameters_test.h │ │ ├── TypeFactory_test.h │ │ ├── TypeName_test.h │ │ └── Variant_test.h │ │ └── src │ │ ├── Archiver_test.cpp │ │ ├── Files_test.cpp │ │ ├── Format_test.cpp │ │ ├── FunctionUtils_test.cpp │ │ ├── Hash_test.cpp │ │ ├── Iterator_test.cpp │ │ ├── MemoryLayout_test.cpp │ │ ├── ObjectArchive_test.cpp │ │ ├── PropertyBag_test.cpp │ │ ├── RingBuffer_test.cpp │ │ ├── TunableParameters_test.cpp │ │ ├── TypeFactory_test.cpp │ │ ├── TypeName_test.cpp │ │ ├── Variant_test.cpp │ │ └── main.cpp └── value │ ├── CMakeLists.txt │ ├── README.md │ ├── doc │ └── README.md │ ├── include │ ├── Array.h │ ├── CachingProvider.h │ ├── CachingStrategies.h │ ├── ComputeContext.h │ ├── CppEmitterContext.h │ ├── Emittable.h │ ├── EmitterContext.h │ ├── FunctionDeclaration.h │ ├── LLVMContext.h │ ├── LoopNests.h │ ├── Matrix.h │ ├── MatrixOperations.h │ ├── Print.h │ ├── Reference.h │ ├── Scalar.h │ ├── ScalarOperations.h │ ├── Tensor.h │ ├── TensorOperations.h │ ├── Value.h │ ├── ValueOperations.h │ ├── ValueType.h │ ├── Vector.h │ ├── VectorOperations.h │ └── loopnests │ │ ├── CodeGenerator.h │ │ ├── CodePositionConstraints.h │ │ ├── ForAll.h │ │ ├── Index.h │ │ ├── IndexRange.h │ │ ├── IterationDomain.h │ │ ├── Kernel.h │ │ ├── KernelPredicate.h │ │ ├── LoopIndexInfo.h │ │ ├── LoopNest.h │ │ ├── LoopNestPrinter.h │ │ ├── LoopNestVisitor.h │ │ ├── Range.h │ │ ├── SplitIndexRange.h │ │ └── SplitIterationDomain.h │ ├── src │ ├── Array.cpp │ ├── CachingProvider.cpp │ ├── CachingStrategies.cpp │ ├── ComputeContext.cpp │ ├── CppEmitterContext.cpp │ ├── Emittable.cpp │ ├── EmitterContext.cpp │ ├── FunctionDeclaration.cpp │ ├── LLVMContext.cpp │ ├── LoopNests.cpp │ ├── Matrix.cpp │ ├── MatrixOperations.cpp │ ├── Print.cpp │ ├── Reference.cpp │ ├── Scalar.cpp │ ├── ScalarOperations.cpp │ ├── Tensor.cpp │ ├── TensorOperations.cpp │ ├── Value.cpp │ ├── ValueOperations.cpp │ ├── Vector.cpp │ ├── VectorOperations.cpp │ └── loopnests │ │ ├── CodeGenerator.cpp │ │ ├── CodePositionConstraints.cpp │ │ ├── ForAll.cpp │ │ ├── Index.cpp │ │ ├── IndexRange.cpp │ │ ├── IterationDomain.cpp │ │ ├── Kernel.cpp │ │ ├── KernelPredicate.cpp │ │ ├── LoopNest.cpp │ │ ├── LoopNestPrinter.cpp │ │ ├── LoopNestVisitor.cpp │ │ ├── Range.cpp │ │ ├── SplitIndexRange.cpp │ │ └── SplitIterationDomain.cpp │ └── test │ ├── include │ ├── CachingStrategy_test.h │ ├── Functions_test.h │ ├── LoopNestAPI_test.h │ ├── LoopNest_convolution_test.h │ ├── LoopNest_kernels.h │ ├── LoopNest_test.h │ ├── Matrix_test.h │ ├── Scalar_test.h │ ├── Tensor_test.h │ ├── TestUtil.h │ ├── Value_test.h │ └── Vector_test.h │ └── src │ ├── CachingStrategy_test.cpp │ ├── Functions_test.cpp │ ├── LoopNestAPI_test.cpp │ ├── LoopNest_convolution_test.cpp │ ├── LoopNest_kernels.cpp │ ├── LoopNest_test.cpp │ ├── Matrix_test.cpp │ ├── Scalar_test.cpp │ ├── Tensor_test.cpp │ ├── TestUtil.cpp │ ├── Value_test.cpp │ ├── Vector_test.cpp │ └── main.cpp ├── requirements.txt ├── scripts ├── CI │ └── Linux │ │ ├── Dockerfile │ │ ├── azure-jekyll-build.yml │ │ ├── azure-linux-build.yml │ │ └── azure-linux-clang-build.yml ├── SETUP-Ubuntu.sh ├── SETUP-Windows.cmd ├── build.cmd ├── build.sh └── rebuild.cmd └── tools ├── CMakeLists.txt ├── importers ├── CMakeLists.txt ├── CNTK │ ├── CMakeLists.txt │ ├── cntk_import.py │ ├── cntk_to_ell.py │ ├── custom_functions.py │ ├── doc │ │ ├── README.md │ │ ├── Updating.md │ │ └── vgg16-snippet.png │ ├── lib │ │ ├── cntk_converters.py │ │ ├── cntk_layers.py │ │ └── cntk_utilities.py │ └── test │ │ ├── CMakeLists.txt │ │ ├── cntk_full_model_test.py │ │ ├── cntk_to_ell_importer_test.py │ │ └── xorModel1.dnn ├── README.md ├── common │ ├── CMakeLists.txt │ ├── converters.py │ ├── importer.py │ ├── memory_shapes.py │ └── test │ │ ├── CMakeLists.txt │ │ └── common_importer_test.py ├── darknet │ ├── CMakeLists.txt │ ├── darknet_import.py │ ├── darknet_to_ell.py │ └── test │ │ ├── CMakeLists.txt │ │ ├── darknet_to_ell_importer_test.py │ │ ├── unittest.cfg │ │ └── unittest.weights ├── onnx │ ├── .gitignore │ ├── CMakeLists.txt │ ├── README.md │ ├── lib │ │ └── onnx_converters.py │ ├── onnx_import.py │ ├── onnx_to_ell.py │ └── test │ │ ├── CMakeLists.txt │ │ └── onnx_node_test.py ├── sample │ └── sample.py └── torch │ ├── CMakeLists.txt │ ├── test │ ├── CMakeLists.txt │ ├── custom_layers.py │ ├── eight.jpg │ └── torch_importer_test.py │ └── torch_verifier.py ├── trainers ├── CMakeLists.txt ├── forestTrainer │ ├── CMakeLists.txt │ └── src │ │ └── main.cpp ├── linearTrainer │ ├── CMakeLists.txt │ ├── include │ │ └── LinearTrainerArguments.h │ └── src │ │ ├── LinearTrainerArguments.cpp │ │ └── main.cpp ├── protoNNTrainer │ ├── CMakeLists.txt │ └── src │ │ └── main.cpp ├── retargetTrainer │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ │ └── RetargetArguments.h │ └── src │ │ ├── RetargetArguments.cpp │ │ └── main.cpp └── sweepingSGDTrainer │ ├── CMakeLists.txt │ └── src │ └── main.cpp ├── utilities ├── CMakeLists.txt ├── apply │ ├── CMakeLists.txt │ ├── include │ │ └── ApplyArguments.h │ └── src │ │ ├── ApplyArguments.cpp │ │ └── main.cpp ├── compile │ ├── CMakeLists.txt │ ├── include │ │ └── CompileArguments.h │ └── src │ │ ├── CompileArguments.cpp │ │ └── main.cpp ├── datasetFromImages │ ├── CMakeLists.txt │ ├── README.md │ └── datasetFromImages.py ├── debugCompiler │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ │ ├── CompareArguments.h │ │ ├── ModelComparison.h │ │ ├── ReplaceSourceAndSinkNodesTransformation.h │ │ └── VectorStatistics.h │ └── src │ │ ├── CompareArguments.cpp │ │ ├── ModelComparison.cpp │ │ ├── ReplaceSourceAndSinkNodesTransformation.cpp │ │ ├── main.cpp │ │ └── visualizeReport.py ├── finetune │ ├── CMakeLists.txt │ ├── README.md │ ├── include │ │ ├── DataStatistics.h │ │ ├── DataUtils.h │ │ ├── FineTuneArguments.h │ │ ├── FineTuneModel.h │ │ ├── ModelOutputDataCache.h │ │ ├── ModelUtils.h │ │ ├── MultidimArray.h │ │ ├── OptimizationUtils.h │ │ ├── PredictorUtils.h │ │ ├── Report.h │ │ └── TransformData.h │ ├── parse_experiment_results.py │ ├── src │ │ ├── DataStatistics.cpp │ │ ├── DataUtils.cpp │ │ ├── FineTuneArguments.cpp │ │ ├── FineTuneModel.cpp │ │ ├── ModelOutputDataCache.cpp │ │ ├── ModelUtils.cpp │ │ ├── OptimizationUtils.cpp │ │ ├── PredictorUtils.cpp │ │ ├── Report.cpp │ │ ├── TransformData.cpp │ │ └── main.cpp │ └── test │ │ ├── include │ │ ├── LoadTestData.h │ │ ├── LoadTestModels.h │ │ ├── TestDataStatistics.h │ │ ├── TestDataUtils.h │ │ ├── TestModelOutputDataCache.h │ │ ├── TestModelUtils.h │ │ ├── TestOptimizationUtils.h │ │ ├── TestPredictorUtils.h │ │ └── TestTransformData.h │ │ └── src │ │ ├── LoadTestData.cpp │ │ ├── LoadTestModels.cpp │ │ ├── TestDataStatistics.cpp │ │ ├── TestDataUtils.cpp │ │ ├── TestModelOutputDataCache.cpp │ │ ├── TestModelUtils.cpp │ │ ├── TestOptimizationUtils.cpp │ │ ├── TestPredictorUtils.cpp │ │ ├── TestTransformData.cpp │ │ ├── generatestats.py │ │ ├── main.cpp │ │ └── train_test_model.py ├── makeExamples │ ├── CMakeLists.txt │ ├── include │ │ ├── GenerateModels.h │ │ └── ModelGenerateArguments.h │ └── src │ │ ├── .gitignore │ │ ├── GenerateModels.cpp │ │ ├── ModelGenerateArguments.cpp │ │ └── main.cpp ├── modelTrace │ └── model_trace.py ├── nodeTiming │ └── gemmCodeNode │ │ ├── .gitignore │ │ ├── README.md │ │ ├── deploy │ │ ├── full_pass.cmd │ │ ├── full_pass.sh │ │ ├── run.py │ │ └── timing_aggregator.py │ │ ├── scripts │ │ ├── build_gemm_models.py │ │ ├── build_tests.py │ │ ├── make_default_models.py │ │ └── special_model_args.py │ │ └── src │ │ ├── CMakeLists.txt.in │ │ └── Runner.cpp.in ├── onnxImportAndCompile │ ├── README.md │ └── onnxImportAndCompile.py ├── optimizer │ ├── CMakeLists.txt │ ├── README.md │ ├── default_options.json │ ├── json_profile_optimizer.py │ ├── optimizer_util.py │ ├── profile_and_optimize.py │ ├── profile_builder.py │ ├── profile_optimizer.py │ ├── profile_runner.py │ └── recover_convolutions.py ├── pitest │ ├── CMakeLists.txt │ ├── README.md │ ├── buildtask.cmd │ ├── coffeemug.jpg │ ├── drivetest.py │ ├── pitest.py │ └── runtest.sh.in ├── print │ ├── CMakeLists.txt │ ├── include │ │ ├── LayerInspector.h │ │ ├── PrintArguments.h │ │ ├── PrintGraph.h │ │ └── PrintModel.h │ └── src │ │ ├── PrintArguments.cpp │ │ ├── PrintGraph.cpp │ │ ├── PrintModel.cpp │ │ └── main.cpp ├── profile │ ├── CMakeLists-device-parallel.txt.in │ ├── CMakeLists-device.txt.in │ ├── CMakeLists.txt │ ├── README.md │ ├── build_and_run.cmd.in │ ├── build_and_run.sh.in │ ├── include │ │ ├── GenerateTestModels.h │ │ ├── ProfileArguments.h │ │ ├── ProfileReport.h │ │ └── ReplaceSourceAndSinkNodesTransformation.h │ ├── make_profiler.cmd.in │ ├── make_profiler.py │ ├── make_profiler.sh.in │ ├── make_profiler_test.cmake │ ├── remote_test.cmd.in │ ├── remote_test.sh.in │ └── src │ │ ├── CompiledExerciseModel_main.cpp │ │ ├── CompiledProfile_main.cpp │ │ ├── GenerateTestModels.cpp │ │ ├── GenerateTestModels_main.cpp │ │ ├── ProfileArguments.cpp │ │ ├── ProfileReport.cpp │ │ ├── ReplaceSourceAndSinkNodesTransformation.cpp │ │ └── main.cpp ├── pythonPlugins │ ├── CMakeLists.txt │ ├── include │ │ └── InvokePython.h │ └── src │ │ ├── InvokePython.cpp │ │ ├── audioConverter.py │ │ └── imageConverter.py ├── pythonlibs │ ├── CMakeLists.txt │ ├── add_input_metadata.py │ ├── add_sink.py │ ├── audio │ │ ├── CMakeLists.txt │ │ ├── classifier.py │ │ ├── compiled_ell_model.py │ │ ├── compute_ell_model.py │ │ ├── featurizer.py │ │ ├── microphone.py │ │ ├── play_audio.py │ │ ├── record.py │ │ ├── run_classifier.py │ │ ├── serial_reader.py │ │ ├── speaker.py │ │ ├── test │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ └── audio_unittest.py │ │ ├── training │ │ │ ├── CMakeLists.txt │ │ │ ├── add_metadata.py │ │ │ ├── add_sink.py │ │ │ ├── add_vad.py │ │ │ ├── dataset.py │ │ │ ├── featurize_wav.py │ │ │ ├── find_ell_root.py │ │ │ ├── make_dataset.py │ │ │ ├── make_featurizer.py │ │ │ ├── make_training_list.py │ │ │ ├── make_vad.py │ │ │ ├── model_editor.py │ │ │ ├── noise_mixer.py │ │ │ ├── rnn.py │ │ │ ├── test_ell_model.py │ │ │ ├── train_classifier.py │ │ │ └── training_config.py │ │ ├── vad.py │ │ ├── vad_test.py │ │ ├── view_audio.py │ │ └── wav_reader.py │ ├── buildtools.py │ ├── cpuinfo.py │ ├── dependency_installer.py │ ├── download_helper.py │ ├── find_ell.py │ ├── logger.py │ ├── modelHelpers.py │ ├── picluster.py │ ├── procmon.py │ ├── remoterunner.py │ ├── version.py │ ├── vision │ │ ├── CMakeLists.txt │ │ ├── add_image_preprocessing_metadata.py │ │ ├── demo.py │ │ ├── demoHelper.py │ │ └── tiled_image.py │ └── ziptools.py └── remoterun │ ├── CMakeLists.txt │ ├── README.md │ └── remoterun.py └── wrap ├── CMakeLists.txt ├── README.md ├── templates ├── CMakeLists.cpp.txt.in ├── CMakeLists.python.txt.in └── __init__.py.in ├── test ├── CMakeLists.txt ├── test.py ├── tutorial.cpp ├── tutorialCMakeLists.txt └── wrap_test.py └── wrap.py /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file for Visual Studio 2 | root = true 3 | 4 | # ensure all files are encoded using utf-8 (even without a BOM). 5 | # this goes together with our CMakeLists.txt /utf-8 compiler flag. 6 | [*] 7 | charset = utf-8 8 | 9 | [*.{asm,bat,cfg,clang-format,cmake,cpp,css,editorconfig,gitattributes,gitignore,gyp,h,html,i,in,inc,js,json,ll,md,py,s,scss,sh,tcc,ts,txt,xslt,yaml,yml] 10 | indent_style = space 11 | indent_size = 4 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = E111,E402,E722,W503,W504,F405,F403 3 | max-line-length = 120 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | services: 4 | - docker 5 | 6 | install: 7 | - export DOCKERHUB_ACCOUNT=cjlovett 8 | - docker pull $DOCKERHUB_ACCOUNT/ell-travis-build:latest 9 | 10 | script: 11 | - docker run -v $TRAVIS_BUILD_DIR:/ELL -it $DOCKERHUB_ACCOUNT/ell-travis-build:latest /bin/sh -c 'cd /ELL; ./scripts/build.sh build 1; cd build; ctest' 12 | -------------------------------------------------------------------------------- /CMake/CompilerCache.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # CompilerCache 3 | # 4 | 5 | if(NOT DEFINED ENV{CMAKE_COMPILER_CACHE}) 6 | set(CMAKE_COMPILER_CACHE ON) 7 | else() 8 | set(CMAKE_COMPILER_CACHE $ENV{CMAKE_COMPILER_CACHE}) 9 | endif() 10 | option(USE_COMPILER_CACHE "Use a compiler cache (ccache) to speed up build times" ${CMAKE_COMPILER_CACHE}) 11 | 12 | if(USE_COMPILER_CACHE) 13 | find_program(CCACHE_EXECUTABLE ccache) 14 | if(CCACHE_EXECUTABLE) 15 | message(STATUS "Found cccache at ${CCACHE_EXECUTABLE}") 16 | 17 | # Support Unix Makefiles and Ninja 18 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_EXECUTABLE}") 19 | set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_EXECUTABLE}") 20 | endif() 21 | else() 22 | message(STATUS "Not using ccache") 23 | endif() 24 | -------------------------------------------------------------------------------- /CMake/Flake8.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # cmake macro for invoking flake8 on all python source files in entire subtree of ${CMAKE_CURRENT_SOURCE_DIR} 3 | # 4 | if(${PYTHON_ENABLED}) 5 | find_program(flake8_BIN NAMES flake8) 6 | if(NOT flake8_BIN) 7 | message(WARNING "### could not find 'flake8', please run 'pip install flake8'") 8 | else() 9 | message(STATUS "using program '${flake8_BIN}' with ${FLAKE8_CONFIG}") 10 | endif() 11 | 12 | # macro to check all python files in CMAKE_CURRENT_SOURCE_DIR 13 | macro(flake8 target_name) 14 | if(flake8_BIN) 15 | add_custom_command(TARGET ${target_name} 16 | PRE_BUILD 17 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 18 | COMMAND ${flake8_BIN} --config ${FLAKE8_CONFIG} . 19 | COMMENT "Running flake8 on ${CMAKE_CURRENT_SOURCE_DIR} ...") 20 | endif() 21 | endmacro() 22 | else() 23 | macro(flake8 target_name) 24 | endmacro() 25 | endif() # PYTHON_ENABLED -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'jekyll' 4 | gem 'jekyll-paginate' 5 | gem 'jekyll-sass-converter' 6 | gem 'jekyll-relative-links' 7 | gem 'kramdown' 8 | gem 'rouge' 9 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 3.1.0 2 | -------------------------------------------------------------------------------- /docs/_data/global.yml: -------------------------------------------------------------------------------- 1 | # Site Settings 2 | title: 'Embedded Learning Library (ELL)' 3 | description: 'An Open Source Library for Embedded AI and Machine Learning from Microsoft' 4 | footer_text: '© 2018 Microsoft Corporation' 5 | 6 | # Admin Settings 7 | admin_name: 'Chris Lovett' 8 | admin_email: 'clovett@microsoft.com' 9 | -------------------------------------------------------------------------------- /docs/_data/nav.yml: -------------------------------------------------------------------------------- 1 | main: 2 | #- { url: '/ELL/', text: 'Home' } 3 | - { url: '/ELL/tutorials/', text: 'Tutorials' } 4 | - { url: '/ELL/gallery/', text: 'Gallery' } 5 | - { url: 'https://github.com/microsoft/ELL', text: 'Code' } -------------------------------------------------------------------------------- /docs/_includes/header.html: -------------------------------------------------------------------------------- 1 | {% include head.html %} 2 | 3 | 4 | 5 |
6 | -------------------------------------------------------------------------------- /docs/_includes/homeheader.html: -------------------------------------------------------------------------------- 1 | {% include head.html %} 2 | 3 | 4 |
5 |
6 |

{{ site.data.global.title }}

7 |

{{ site.data.global.description }}

8 |
9 |
10 | 11 |
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 14 | 15 | #include 16 | 17 | ell::MultiClassDataContainer LoadSmallMNISTDataContainer(); 18 | ell::MultiClassDataContainer LoadTrivialConvDataContainer(); 19 | ell::MultiClassDataContainer LoadTrivialConvDataContainer2(); 20 | 21 | ell::UnlabeledDataContainer GetSimpleStatsDataset(); 22 | ell::math::RowVector GetSimpleStatsDatasetMean(); 23 | ell::math::RowVector GetSimpleStatsDatasetStdDev(); 24 | double GetSimpleStatsDatasetScalarMean(); 25 | double GetSimpleStatsDatasetScalarStdDev(); 26 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/LoadTestModels.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: LoadTestModels.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | #include 14 | 15 | std::string GetFullyConnectedMNISTModelPath(); 16 | std::string GetConvolutionalMNISTModelPath(); 17 | std::string GetSuperSimpleConvolutionalMNISTModelPath(); 18 | std::string GetTrivialConvolutionalModelPath(); 19 | std::string GetTrivialConvolutionalModel2Path(); 20 | 21 | ell::model::Model LoadFullyConnectedMNISTModel(); 22 | ell::model::Model LoadConvolutionalMNISTModel(); 23 | ell::model::Model LoadSuperSimpleConvolutionalMNISTModel(); 24 | ell::model::Model LoadTrivialConvolutionalModel(); 25 | ell::model::Model LoadTrivialConvolutionalModel2(); 26 | 27 | ell::model::Model GetNodeFindingTestModel(); 28 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/TestDataStatistics.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestDataStatistics.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | // Main driver function 12 | void TestDataStatistics(); 13 | 14 | // Individual tests 15 | void TestGetDataStatistics(); 16 | void TestGetScalarDataStatistics(); 17 | void TestGetNormalizedData(); 18 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/TestDataUtils.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestDataUtils.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | // Main driver function 12 | void TestDataUtils(); 13 | 14 | // Individual tests 15 | void TestLoadBinaryLabelDataContainer(); 16 | void TestLoadMultiClassDataContainer(); 17 | void TestLoadCifarDataContainer(); 18 | void TestLoadMnistDataContainer(); 19 | 20 | void TestCreateVectorLabelDataContainer(); 21 | void TestBinaryGetDatasetInputs(); 22 | void TestMultiClassGetDatasetInputs(); 23 | void TestVectorLabelGetDatasetInputs(); 24 | void TestGetDatasetOutputs(); 25 | void TestGetImageMatrixDataset(); 26 | void TestGetUnrolledImageDataset(); 27 | void TestBinaryGetModelAccuracy(); 28 | void TestMultiClassGetModelAccuracy(); 29 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/TestModelOutputDataCache.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestModelOutputDataCache.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | // Main driver function 12 | void TestModelOutputDataCache(); 13 | 14 | // Individual tests 15 | void TestModelOutputDataCache_CreateAndPopulate(); 16 | void TestModelOutputDataCache_FindNearestCachedOutput(); 17 | void TestModelOutputDataCache_TransformWithCache(); 18 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/TestModelUtils.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestModelUtils.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | // Main driver function 12 | void TestModelUtils(); 13 | 14 | // Individual tests 15 | void TestIsNeuralNetworkPredictorNode(); 16 | void TestIsFullyConnectedLayerNode(); 17 | void TestIsConvolutionalLayerNode(); 18 | 19 | void TestAppendSinkNode(); 20 | void TestAppendOutputWithSink(); 21 | 22 | void TestFindNearestCommonAncestor(); 23 | void TestIsCompleteAncestor(); 24 | void TestGetCompleteAncestors(); 25 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/TestOptimizationUtils.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestOptimizationUtils.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | // Main driver function 12 | void TestOptimizationUtils(); 13 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/TestPredictorUtils.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestPredictorUtils.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | // Main driver function 12 | void TestPredictorUtils(); 13 | 14 | // Individual tests 15 | void TestGetWeightsAndBias(); 16 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/include/TestTransformData.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestTransformData.h (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | // Main driver function 12 | void TestTransformData(); 13 | 14 | // Individual tests 15 | void TestRemovePadding(); 16 | void TestTransformDataWithModel(); 17 | void TestTransformDataWithSubmodel(); 18 | void TestTransformDataWithCachedSubmodel(); 19 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/src/TestOptimizationUtils.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: TestOptimizationUtils.cpp (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #include "TestOptimizationUtils.h" 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | using namespace ell; 24 | using namespace ell::testing; 25 | 26 | void TestOptimizationUtils() 27 | { 28 | NoFailOnUnimplemented([]() { 29 | throw TestNotImplementedException("TestOptimizationUtils"); 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /tools/utilities/finetune/test/src/main.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: main.cpp (finetune_test) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #include "TestDataStatistics.h" 10 | #include "TestDataUtils.h" 11 | #include "TestModelOutputDataCache.h" 12 | #include "TestModelUtils.h" 13 | #include "TestOptimizationUtils.h" 14 | #include "TestTransformData.h" 15 | 16 | #include 17 | 18 | using namespace ell; 19 | 20 | int main(int argc, char* argv[]) 21 | { 22 | TestDataStatistics(); 23 | TestDataUtils(); 24 | TestModelUtils(); 25 | TestOptimizationUtils(); 26 | TestTransformData(); 27 | TestModelOutputDataCache(); 28 | 29 | return testing::GetExitCode(); 30 | } 31 | -------------------------------------------------------------------------------- /tools/utilities/makeExamples/include/GenerateModels.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: GenerateModels.h (makeExamples) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | ell::model::Model GenerateIdentityModel(size_t dimension); 14 | ell::model::Model GenerateTimesTwoModel(size_t dimension); 15 | template 16 | ell::model::Model GenerateBroadcastTimesTwoModel(size_t dimension); 17 | ell::model::Model GenerateIsEqualModel(); 18 | ell::model::Model GenerateArgMaxModel(size_t dimension); 19 | ell::model::Model GenerateMultiOutModel(size_t dimension); 20 | ell::model::Model GenerateModel1(); 21 | ell::model::Model GenerateModel2(); 22 | ell::model::Model GenerateModel3(); 23 | ell::model::Model GenerateTreeModel(size_t numSplits); 24 | ell::model::Model GenerateRefinedTreeModel(size_t numSplits); 25 | -------------------------------------------------------------------------------- /tools/utilities/makeExamples/src/.gitignore: -------------------------------------------------------------------------------- 1 | *.onnx 2 | *.pth 3 | *.pty 4 | *.gsdf 5 | *.ell 6 | -------------------------------------------------------------------------------- /tools/utilities/makeExamples/src/ModelGenerateArguments.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: ModelGenerateArguments.cpp (utilities) 5 | // Authors: Lisa Ong 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #include "ModelGenerateArguments.h" 10 | 11 | namespace ell 12 | { 13 | void ParsedModelGenerateArguments::AddArgs(utilities::CommandLineParser& parser) 14 | { 15 | parser.AddOption( 16 | outputType, 17 | "outputType", 18 | "o", 19 | "Choice of output type: model, map", 20 | { { "model", OutputType::model }, { "map", OutputType::map } }, 21 | "model"); 22 | 23 | parser.AddOption( 24 | outputPath, 25 | "outputPath", 26 | "p", 27 | "The output path", 28 | ""); 29 | } 30 | } // namespace ell 31 | -------------------------------------------------------------------------------- /tools/utilities/nodeTiming/gemmCodeNode/.gitignore: -------------------------------------------------------------------------------- 1 | models/ 2 | test_*/ 3 | -------------------------------------------------------------------------------- /tools/utilities/nodeTiming/gemmCodeNode/deploy/full_pass.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM #################################################################################################### 3 | REM # 4 | REM # Project: Embedded Learning Library (ELL) 5 | REM # File: full_pass.cmd 6 | REM # Authors: Mason Remy 7 | REM # 8 | REM #################################################################################################### 9 | 10 | call import_all.cmd 11 | call build_all.cmd 12 | call run_all.cmd -------------------------------------------------------------------------------- /tools/utilities/nodeTiming/gemmCodeNode/deploy/full_pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #################################################################################################### 3 | # 4 | # Project: Embedded Learning Library (ELL) 5 | # File: full_pass.sh 6 | # Authors: Mason Remy 7 | # 8 | #################################################################################################### 9 | 10 | chmod +x import_all.sh 11 | ./import_all.sh 12 | 13 | chmod +x build_all.sh 14 | ./build_all.sh 15 | 16 | chmod +x run_all.sh 17 | ./run_all.sh 18 | -------------------------------------------------------------------------------- /tools/utilities/nodeTiming/gemmCodeNode/scripts/special_model_args.py: -------------------------------------------------------------------------------- 1 | #################################################################################################### 2 | # 3 | # Project: Embedded Learning Library (ELL) 4 | # File: special_model_args.py 5 | # Authors: Mason Remy 6 | # 7 | # Requires: Python 3.x 8 | # 9 | #################################################################################################### 10 | 11 | special_model_args = { 12 | "gemmELL.ell": ["--blas false"] 13 | } -------------------------------------------------------------------------------- /tools/utilities/nodeTiming/gemmCodeNode/src/CMakeLists.txt.in: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for MatrixMatrixMultiplyCodeNode timing scripts 3 | # 4 | 5 | cmake_minimum_required(VERSION 2.8) 6 | project(MatrixMatrixMultiplyCodeNodeRunner) 7 | set(CMAKE_CXX_STANDARD 11) 8 | 9 | @ADD_SUBDIRECTORIES@ 10 | 11 | add_definitions(-DRUN_COUNT=@RUN_COUNT@) 12 | add_definitions(-DWARMUP_COUNT=@WARMUP_COUNT@) 13 | add_executable(Runner Runner.cpp) 14 | 15 | if(MSVC) 16 | target_link_libraries(Runner @LINK_LIBRARIES@) 17 | elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) 18 | target_link_libraries(Runner @LINK_LIBRARIES@ -Wl) 19 | else() 20 | target_link_libraries(Runner @LINK_LIBRARIES@ -Wl,--gc-sections) 21 | endif() 22 | -------------------------------------------------------------------------------- /tools/utilities/onnxImportAndCompile/README.md: -------------------------------------------------------------------------------- 1 | ## onnxImportAndCompile.py 2 | 3 | This tool imports an ONNX file, converts it to .ell, and calls wrap.py. 4 | 5 | ## Prerequisites 6 | 7 | The tool relies on the following python libraries: 8 | * argparse 9 | * validators 10 | 11 | ## Usage 12 | 13 | ``` 14 | python onnxImportAndCompile.py [--onnx ONNX_FILE] 15 | [--lang OUTPUT_LANGUAGE] 16 | [--target TARGET_LIST] 17 | ``` 18 | 19 | * **ONNX_FILE** - ONNX file path to be imported. This can be a local path or a URL 20 | * **OUTPUT_LANGUAGE** - Output language for wrap script (examples: 'cpp' or 'python') 21 | * **TARGET_LIST** - The target platform(s) for the wrap script, as a comma-separted list (i.e. 'pi0,pi3') 22 | -------------------------------------------------------------------------------- /tools/utilities/optimizer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for python optimizer utilities 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | 7 | set(module_name "optimizer") 8 | 9 | set(lib_src 10 | optimizer_util.py 11 | profile_builder.py 12 | profile_runner.py 13 | profile_optimizer.py 14 | profile_and_optimize.py 15 | recover_convolutions.py 16 | json_profile_optimizer.py) 17 | 18 | add_custom_target(${module_name} DEPENDS SOURCES ${lib_src}) 19 | 20 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/utilities") 21 | 22 | # copy files 23 | copy_newer_files(${module_name} lib_src) 24 | 25 | # run flake8 26 | flake8(${module_name}) 27 | 28 | endif() -------------------------------------------------------------------------------- /tools/utilities/optimizer/default_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "convolution_methods": [ 3 | "simple", 4 | "unrolled", 5 | "winograd" 6 | ], 7 | "parallel": [ 8 | true, 9 | false 10 | ], 11 | "winograd_parameters": [ 12 | 1, 13 | 2, 14 | 4, 15 | 6, 16 | 8, 17 | 16 18 | ] 19 | } -------------------------------------------------------------------------------- /tools/utilities/pitest/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi test tools 2 | 3 | ## Requirements 4 | 5 | paramiko (SSH client) 6 | 7 | ``` 8 | conda install paramiko 9 | ``` 10 | 11 | getpass (for safely prompting for a password) 12 | 13 | ``` 14 | conda install getpass 15 | ``` 16 | 17 | ## Using remoterunner with make_profile to execute a profile app remotely: 18 | 19 | First build the profiler: 20 | ``` 21 | bin/make_profiler.sh d_I160x160x3NCMNCMNBMNBMNBMNBMNB1A.ell profile_pi_par4 --target pi3 -vec -par -th 4 22 | ``` 23 | 24 | Then push it to the remote and build: 25 | 26 | ``` 27 | python tools/utilities/pitest/remoterunner.py 157.54.156.100 --source_dir ./profile_pi_par4 --target_dir profile_pi_par4 28 | ``` 29 | 30 | -------------------------------------------------------------------------------- /tools/utilities/pitest/coffeemug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/ELL/2a3f938ca4becebdc448bfdfd8ebf7f5ab437265/tools/utilities/pitest/coffeemug.jpg -------------------------------------------------------------------------------- /tools/utilities/pitest/runtest.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | x=$(pgrep -x "runtest.sh" | wc -l) 3 | if [ "$x" -gt "2" ]; then 4 | echo "### runtest.sh is already running!!" 5 | exit 1 6 | fi 7 | x=$(pgrep -x "validate.sh" | wc -l) 8 | if [ "$x" -gt "2" ]; then 9 | echo "### validate.sh is running!!" 10 | exit 1 11 | fi 12 | if [ -f "/home/pi/miniconda3/bin/activate" ]; then 13 | export PATH="/home/pi/miniconda3/bin:$PATH" 14 | source activate py34 > /dev/null 2>&1 15 | fi 16 | export TERM=xterm-mono 17 | 18 | cd @TARGET_DIR@ 19 | if [ -d "build" ]; then 20 | rm -rf build 21 | fi 22 | mkdir build && cd build 23 | cmake .. 24 | make 25 | cd .. 26 | export DISPLAY=:0 27 | echo running python3 demo.py @LABELS@ --compiled_model @COMPILED_MODEL@ --image coffeemug.jpg --iterations @ITERATIONS@ --nogui 28 | python3 demo.py @LABELS@ --compiled_model @COMPILED_MODEL@ --image coffeemug.jpg --iterations @ITERATIONS@ --nogui 29 | echo ==== runtest.sh is finished ==== 30 | 31 | -------------------------------------------------------------------------------- /tools/utilities/print/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for print project 3 | # 4 | 5 | # define project 6 | set(tool_name print) 7 | 8 | set(src 9 | src/PrintArguments.cpp 10 | src/PrintGraph.cpp 11 | src/PrintModel.cpp 12 | src/main.cpp 13 | ) 14 | 15 | set(include 16 | include/LayerInspector.h 17 | include/PrintArguments.h 18 | include/PrintGraph.h 19 | include/PrintModel.h 20 | ) 21 | 22 | source_group("src" FILES ${src}) 23 | source_group("include" FILES ${include}) 24 | 25 | # create executable in build\bin 26 | set(GLOBAL_BIN_DIR ${CMAKE_BINARY_DIR}/bin) 27 | set(EXECUTABLE_OUTPUT_PATH ${GLOBAL_BIN_DIR}) 28 | add_executable(${tool_name} ${src} ${include}) 29 | target_include_directories(${tool_name} PRIVATE include ${ELL_LIBRARIES_DIR}) 30 | target_link_libraries(${tool_name} common model nodes passes utilities) 31 | copy_shared_libraries(${tool_name}) 32 | 33 | set_property(TARGET ${tool_name} PROPERTY FOLDER "tools/utilities") 34 | -------------------------------------------------------------------------------- /tools/utilities/print/include/PrintGraph.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: PrintGraph.h (print) 5 | // Authors: Chris Lovett 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace ell 16 | { 17 | void PrintGraph(const model::Model& model, const std::string& outputFormat, std::ostream& out, bool includeNodeId); 18 | } 19 | -------------------------------------------------------------------------------- /tools/utilities/print/include/PrintModel.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: PrintModel.h (print) 5 | // Authors: Chuck Jacobs 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace ell 16 | { 17 | struct PrintModelOptions 18 | { 19 | bool includeNodeId = false; 20 | bool nodeDetails = true; 21 | }; 22 | void PrintModel(const model::Model& model, std::ostream& out, const PrintModelOptions& options); 23 | } // namespace ell 24 | -------------------------------------------------------------------------------- /tools/utilities/profile/build_and_run.cmd.in: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | SETLOCAL ENABLEEXTENSIONS 3 | cd %~dp0 4 | 5 | REM A script that builds and runs the CMake project 6 | REM - create build directory 7 | REM - cd to build directory, run cmake and make 8 | REM - run the specified command passed in as commandline parameters 9 | 10 | REM Create build directory and build project 11 | 12 | if EXIST build rd /s /q build 13 | mkdir build 14 | cd build 15 | set GENERATOR=@CMAKE_GENERATOR@ 16 | if "%GENERATOR:Win64=%"=="%GENERATOR%" ( 17 | cmake -G "%GENERATOR%" -A X64 .. 18 | ) else ( 19 | cmake -G "%GENERATOR%" .. 20 | ) 21 | if ERRORLEVEL 1 exit /b 1 22 | cmake --build . --config Release -- /v:m 23 | if ERRORLEVEL 1 exit /b 1 24 | cd Release 25 | 26 | REM Run profile tool with arguments given on the command line 27 | echo "Running ELL profiler tool -- normal" 28 | profile 100 20 29 | 30 | REM echo "Running ELL profiler tool -- opt" 31 | profile_opt 100 20 32 | 33 | REM Run exercise_model tool with 10 iterations 34 | exercise_model.exe 100 35 | 36 | REM run exercise_model_opt 37 | exercise_model_opt 100 -------------------------------------------------------------------------------- /tools/utilities/pythonPlugins/include/InvokePython.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Project: Embedded Learning Library (ELL) 4 | // File: InvokePython.h (pythonPlugins) 5 | // Authors: Chris Lovett 6 | // 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | ///Execute the given python script, passing the given arguments as sys.argv and getting back an array of floating point numbers 14 | std::vector ExecutePythonScript(const std::string& filePath, const std::vector& args); 15 | -------------------------------------------------------------------------------- /tools/utilities/pythonlibs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for python utilities 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | 7 | set(module_name "pythonlibs") 8 | 9 | set(lib_src 10 | add_input_metadata.py 11 | buildtools.py 12 | cpuinfo.py 13 | dependency_installer.py 14 | download_helper.py 15 | find_ell.py 16 | logger.py 17 | modelHelpers.py 18 | picluster.py 19 | procmon.py 20 | remoterunner.py 21 | ziptools.py) 22 | 23 | add_subdirectory(vision) 24 | add_subdirectory(audio) 25 | 26 | add_custom_target(${module_name} DEPENDS SOURCES ${lib_src}) 27 | 28 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/utilities") 29 | 30 | # copy files 31 | copy_newer_files(${module_name} lib_src) 32 | 33 | # run flake8 34 | flake8(${module_name}) 35 | 36 | endif() -------------------------------------------------------------------------------- /tools/utilities/pythonlibs/audio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for python audio utilities 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | 7 | set(module_name "pythonlibs-audio") 8 | 9 | file(GLOB lib_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py) 10 | 11 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${lib_src}) 12 | add_dependencies(${module_name} pythonlibs) 13 | 14 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/utilities/audio") 15 | 16 | # copy files 17 | copy_newer_files(${module_name} lib_src) 18 | 19 | add_subdirectory(training) 20 | add_subdirectory(test) 21 | 22 | endif() # PYTHON_ENABLED 23 | -------------------------------------------------------------------------------- /tools/utilities/pythonlibs/audio/test/.gitignore: -------------------------------------------------------------------------------- 1 | test/ -------------------------------------------------------------------------------- /tools/utilities/pythonlibs/audio/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for python audio utilities 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | 7 | set(module_name "pythonlibs-audio-test") 8 | 9 | file(GLOB test_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py) 10 | 11 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${test_src}) 12 | add_dependencies(${module_name} pythonlibs) 13 | 14 | set_property(TARGET ${module_name} PROPERTY FOLDER "tests") 15 | 16 | # copy files 17 | copy_newer_files(${module_name} test_src) 18 | 19 | # unit test 20 | if(${ONNX}) 21 | add_test(NAME ${module_name} COMMAND ${PYTHON_EXECUTABLE} -m unittest ${test_src}) 22 | endif() # ONNX 23 | 24 | endif() # PYTHON_ENABLED 25 | -------------------------------------------------------------------------------- /tools/utilities/pythonlibs/audio/training/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for python audio training utilities 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | 7 | set(module_name "pythonlibs-audio-training") 8 | 9 | file(GLOB lib_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py) 10 | 11 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${lib_src}) 12 | add_dependencies(${module_name} pythonlibs) 13 | 14 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/utilities/audio/training") 15 | 16 | # copy files 17 | copy_newer_files(${module_name} lib_src) 18 | 19 | endif() # PYTHON_ENABLED 20 | -------------------------------------------------------------------------------- /tools/utilities/pythonlibs/vision/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file for python vision utilities 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | 7 | set(module_name "pythonlibs-vision") 8 | 9 | set(lib_src 10 | add_image_preprocessing_metadata.py 11 | demo.py 12 | demoHelper.py 13 | tiled_image.py) 14 | 15 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${lib_src}) 16 | add_dependencies(${module_name} pythonlibs) 17 | 18 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/utilities/vision") 19 | 20 | # copy files 21 | copy_newer_files(${module_name} lib_src) 22 | 23 | endif() # PYTHON_ENABLED 24 | -------------------------------------------------------------------------------- /tools/utilities/remoterun/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # CMake file for Raspberry Pi test tools 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | 7 | set(module_name "remoterun") 8 | 9 | set(src remoterun.py) 10 | 11 | add_custom_target(${module_name} ALL DEPENDS SOURCES ${src}) 12 | add_dependencies(${module_name} pythonlibs) 13 | set_property(TARGET ${module_name} PROPERTY FOLDER "tools/utilities") 14 | 15 | # copy files 16 | copy_newer_files(${module_name} src) 17 | 18 | flake8(${module_name}) 19 | endif() # PYTHON_ENABLED 20 | -------------------------------------------------------------------------------- /tools/utilities/remoterun/README.md: -------------------------------------------------------------------------------- 1 | ## remoterun.py 2 | 3 | This tool (optionally) copies a directory to a remote computer and then (optionally) runs a specified command with the copied directory as the working directory. 4 | 5 | ## Prerequisites 6 | 7 | The tool relies on the following python libraries, all available via `conda install `: 8 | 9 | * paramiko 10 | * getpass 11 | 12 | ## Usage 13 | 14 | ``` 15 | python remoterun.py [-h] [--source_dir SOURCE_DIR] [--target_dir TARGET_DIR] 16 | [--username USERNAME] [--password PASSWORD] 17 | [--command [COMMAND [COMMAND ...]]] [--logfile LOGFILE] 18 | [--verbose] [--cleanup CLEANUP] 19 | ipaddress 20 | ``` 21 | 22 | *Limitations:* 23 | Only a single level of hierarchy for the `target_dir` is supported. 24 | Only the immediate contents of `source_dir` are copied (non-recursive copy). 25 | -------------------------------------------------------------------------------- /tools/wrap/templates/__init__.py.in: -------------------------------------------------------------------------------- 1 | # 2 | # Generated __init__.py for compiled model 3 | # 4 | 5 | import os 6 | import sys 7 | _this_dir = os.path.dirname(os.path.abspath(__file__)) 8 | sys.path += [ os.path.join(_this_dir, "build") ] 9 | sys.path += [ os.path.join(_this_dir, "build", "Release") ] 10 | 11 | print("Importing @ELL_model_name@") 12 | from . import @ELL_model_name@ 13 | 14 | __all__ = [@ELL_model_name@] 15 | -------------------------------------------------------------------------------- /tools/wrap/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # cmake file 3 | # 4 | 5 | if(${PYTHON_ENABLED}) 6 | set(test_name wrap-test) 7 | 8 | file(GLOB test_src RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py *.cpp tutorialCMakeLists.txt) 9 | 10 | add_custom_target(${test_name} ALL DEPENDS ${test_src} SOURCES ${test_src}) 11 | add_dependencies(${test_name} wrap _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 this 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 | -------------------------------------------------------------------------------- /tools/wrap/test/tutorialCMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.3) 2 | project(tutorial) 3 | set(CMAKE_CXX_STANDARD 11) 4 | 5 | add_subdirectory(model) 6 | 7 | add_executable(tutorial tutorial.cpp) 8 | target_link_libraries(tutorial ${OpenCV_LIBS} model) 9 | --------------------------------------------------------------------------------