From 2886ed5697c86dbb9d71892a06608fbd20f0d638 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 8 Oct 2020 18:55:44 -0400 Subject: [PATCH 001/114] Attempt to use Azure to build the MSI. --- .ci/windows-steps.yaml | 94 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 69a33520a3..8cf26046fe 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -122,6 +122,95 @@ steps: replaceExistingArchive: true displayName: 'Build artifacts' +# Build MSI installer. +- powershell: | + # Pull the documentation for the installer. + try { + (new-object net.webclient).DownloadFile(${env:JENKINS_DOC_DOWNLOAD}, + 'dist\win-installer\jenkinsdoc.zip') + } + catch { + Write-Output "Unable to download precompiled Doxygen documentation from Jenkins!" + } + try { + (Add-Type -AssemblyName System.IO.Compression.FileSystem); + [System.IO.Compression.ZipFile]::ExtractToDirectory(${env:JENKINS_DOC}, + 'dist\win-installer\staging\doc') + } + catch { + Write-Output "Unable to add doc to installer, skipping!" + } + # Preparing installer staging. + mkdir dist\win-installer\staging\lib + cp build\Release\*.lib dist\win-installer\staging\lib\ + cp build\Release\*.exp dist\win-installer\staging\lib\ + cp build\Release\*.dll dist\win-installer\staging\ + cp build\Release\*.exe dist\win-installer\staging\ + cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\staging\ + cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\staging\ + cp build\include\mlpack dist\win-installer\staging -recurse + cp doc\examples dist\win-installer\staging -recurse + cp src\mlpack\tests\data\german.csv dist\win-installer\staging\examples\sample-ml-app\sample-ml-app\data\ + # Check current git version or mlpack version. + $ver = (Get-Content + "src\mlpack\core\util\version.hpp" | + where {$_ -like "*MLPACK_VERSION*"}); + $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; + $env:MLPACK_VERSION += $ver[1].substring($ver[1].length - 1, 1) + '.'; + $env:MLPACK_VERSION += $ver[2].substring($ver[2].length - 1, 1); + + if (Test-Path "src/mlpack/core/util/gitversion.hpp") + { + $ver = (Get-Content ${env:GIT_VERSION_FILE}); + $env:INSTALL_VERSION = $ver.Split('"')[1].Split(' ')[1]; + } + else + { + $env:INSTALL_VERSION = $env:MLPACK_VERSION; + } + # Build the MSI installer. + cd dist\win-installer\mlpack-win-installer + heat dir ..\staging + -cg HeatGenerated + -dr INSTALLFOLDER + -sreg + -srd + -var var.HarvestPath + -ag + -sfrag + -out HeatGeneratedFileList.wxs + candle + -dHarvestPath=..\staging + -dConfiguration=Release + -dOutDir=bin\x64\Release\ + -dPlatform=x64 + -dProjectDir=. + -dProjectExt=.wixproj + -dProjectFileName=mlpack-win-installer.wixproj + -dProjectName=mlpack-win-installer + -dProjectPath=mlpack-win-installer.wixproj + -dTargetDir=.\bin\x64\Release\ + -dTargetExt=.msi + -dTargetFileName=mlpack-windows.msi + -dTargetName=mlpack-windows + -dTargetPath=.\bin\x64\Release\mlpack-windows.msi + -out obj\x64\Release\ + -arch x64 + -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" + Product.wxs HeatGeneratedFileList.wxs + light + -out .\bin\x64\Release\mlpack-%INSTALL_VERSION%.msi + -pdbout .\bin\x64\Release\mlpack-windows.wixpdb + -cultures:null + -loc mlpack-localization.wxl + -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" + -contentsfile obj\x64\Release\mlpack-win-installer.wixproj.BindContentsFileListnull.txt + -outputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindOutputsFileListnull.txt + -builtoutputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt + -wixprojectfile mlpack-win-installer.wixproj + obj\x64\Release\Product.wixobj obj\x64\Release\HeatGeneratedFileList.wixobj + displayName: 'Build MSI Windows installer' + # Publish artifacts to Azure Pipelines - task: PublishBuildArtifacts@1 inputs: @@ -138,6 +227,11 @@ steps: pathtoPublish: 'build/Testing/' artifactName: 'Tests' displayName: 'Publish artifacts test results' +- task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: 'dist\win-installer\mlpack-win-installer\bin\x64\Release\*.msi' + artifactName: mlpack-windows-installer + displayName: 'Publish Windows MSI installer' # Publish test results to Azure Pipelines - task: PublishTestResults@2 From 0a8928d4cc44eab60e20aa4150ed76412f63bc72 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 8 Oct 2020 18:55:55 -0400 Subject: [PATCH 002/114] Remove the AppVeyor configuration entirely. --- .appveyor.yml | 258 -------------------------------------------------- 1 file changed, 258 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 633d0c120f..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,258 +0,0 @@ -clone_depth: 10 - -environment: - BOOST_PROG_OPTION : "C:/projects/mlpack/\ - boost_program_options-vc140.1.60.0.0/lib/native/address-model-64/lib/*.*" - BOOST_MATH : "C:/projects/mlpack/\ - boost_math_c99-vc140.1.60.0.0/lib/native/address-model-64/lib/*.*" - BOOST_RANDOM : "C:/projects/mlpack/\ - boost_random-vc140.1.60.0.0/lib/native/address-model-64/lib/*.*" - BOOST_SERIALIZATION : "C:/projects/mlpack/\ - boost_serialization-vc140.1.60.0.0/lib/native/address-model-64/lib/*.*" - BOOST_UNIT_TEST : "C:/projects/mlpack/\ - boost_unit_test_framework-vc140.1.60.0.0/lib/native/address-model-64/lib/*.*" - ARMADILLO_DOWNLOAD : "https://data.kurg.org/armadillo-8.400.0.tar.xz" - ARMADILLO_LIBRARY : "C:/projects/mlpack/armadillo-8.400.0/\ - build/Debug/armadillo.lib" - BLAS_LIBRARY : "%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/\ - libopenblas.dll.a" - BOOST_INCLUDE : "C:/projects/mlpack/boost.1.60.0.0/lib/native/include" - JENKINS_DOC_DOWNLOAD : "http://ci.mlpack.org/job/mlpack%20-%20doxygen%20\ - build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip" - JENKINS_DOC : "C:/projects/mlpack/dist/win-installer/jenkinsdoc.zip" - GIT_VERSION_FILE : "C:/projects/mlpack/src/mlpack/core/util/gitversion.hpp" - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - VSVER: Visual Studio 14 2015 Win64 - MSBUILD: C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - VSVER: Visual Studio 15 2017 Win64 - MSBUILD: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe -# Currently, the VS2019 build seems to always time out. This seems to be an -# AppVeyor issue. -# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 -# VSVER: Visual Studio 16 2019 -# MSBUILD: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe - - -configuration: Release - -os: Visual Studio 2015 - -install: - - ps: nuget install boost -o "${env:APPVEYOR_BUILD_FOLDER}" -Version 1.60.0 - - ps: > - nuget install boost_unit_test_framework-vc140 - -o "${env:APPVEYOR_BUILD_FOLDER}" -Version 1.60.0 - - ps: > - nuget install boost_program_options-vc140 - -o "${env:APPVEYOR_BUILD_FOLDER}" -Version 1.60.0 - - ps: > - nuget install boost_random-vc140 - -o "${env:APPVEYOR_BUILD_FOLDER}" -Version 1.60.0 - - ps: > - nuget install boost_serialization-vc140 - -o "${env:APPVEYOR_BUILD_FOLDER}" -Version 1.60.0 - - ps: > - nuget install boost_math_c99-vc140 - -o "${env:APPVEYOR_BUILD_FOLDER}" -Version 1.60.0 - - ps: nuget install OpenBLAS -o "${env:APPVEYOR_BUILD_FOLDER}" - - set path=C:\Program Files (x86)\WiX Toolset v3.11\bin;%path% - -build_script: - - mkdir boost_libs - - ps: cp ${env:BOOST_PROG_OPTION} C:\projects\mlpack\boost_libs\ - - ps: cp ${env:BOOST_MATH} C:\projects\mlpack\boost_libs\ - - ps: cp ${env:BOOST_RANDOM} C:\projects\mlpack\boost_libs\ - - ps: cp ${env:BOOST_SERIALIZATION} C:\projects\mlpack\boost_libs\ - - ps: cp ${env:BOOST_UNIT_TEST} C:\projects\mlpack\boost_libs\ - - echo TEST_ARMA is %ARMADILLO_DOWNLOAD% - - > - appveyor DownloadFile %ARMADILLO_DOWNLOAD% - -FileName armadillo.tar.xz - - 7z x armadillo.tar.xz -so -txz | 7z x -si -ttar > nul - - cd armadillo-8.400.0 && mkdir build && cd build - - > - cmake -G "%VSVER%" - -DBLAS_LIBRARY:FILEPATH=%BLAS_LIBRARY% - -DLAPACK_LIBRARY:FILEPATH=%BLAS_LIBRARY% - -DCMAKE_PREFIX:FILEPATH="%APPVEYOR_BUILD_FOLDER%/armadillo" - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_BUILD_TYPE=Release .. - - > - "%MSBUILD%" "C:\projects\mlpack\armadillo-8.400.0\build\armadillo.sln" - /m /verbosity:quiet /p:Configuration=Release;Platform=x64 - - cd C:\projects\mlpack && mkdir build && cd build - - > - cmake -G "%VSVER%" - -DBLAS_LIBRARIES:FILEPATH=%BLAS_LIBRARY% - -DLAPACK_LIBRARIES:FILEPATH=%BLAS_LIBRARY% - -DARMADILLO_INCLUDE_DIR="C:/projects/mlpack/armadillo-8.400.0/include" - -DARMADILLO_LIBRARY:FILEPATH=%ARMADILLO_LIBRARY% - -DBOOST_INCLUDEDIR:PATH=%BOOST_INCLUDE% - -DBOOST_LIBRARYDIR:PATH="C:/projects/mlpack/boost_libs" - -DDEBUG=OFF - -DPROFILE=OFF - -DBUILD_PYTHON_BINDINGS=OFF - -DBUILD_GO_BINDINGS=OFF - -DBUILD_R_BINDINGS=OFF - -DCMAKE_BUILD_TYPE=Release .. - - > - "%MSBUILD%" "C:\projects\mlpack\build\mlpack.sln" - /m /verbosity:minimal /nologo /p:BuildInParallel=true - /p:Configuration=Release;Platform=x64 - - # Zip Artifacts. - - > - 7z a mlpack-windows-no-libs.zip - "%APPVEYOR_BUILD_FOLDER%\build\Release\*.exe" - - > - 7z a mlpack-windows.zip - "%APPVEYOR_BUILD_FOLDER%\build\Release\*.*" - "%APPVEYOR_BUILD_FOLDER%/OpenBLAS.0.2.14.1/lib/native/lib/x64/*.*" - - # Pulling documentation for the installer. - - ps: > - try{(new-object net.webclient).DownloadFile(${env:JENKINS_DOC_DOWNLOAD}, - 'C:\projects\mlpack\dist\win-installer\jenkinsdoc.zip')} - catch{Write-Output "Unable to pull jenkins doc, skipping!"} - - ps: > - try{(Add-Type -AssemblyName System.IO.Compression.FileSystem); - [System.IO.Compression.ZipFile]::ExtractToDirectory(${env:JENKINS_DOC}, - 'C:\projects\mlpack\dist\win-installer\staging\doc')} - catch{Write-Output "Unable to add doc to installer, skipping!"} - - # Preparing installer staging. - - cd C:\projects\mlpack\dist\win-installer\staging && mkdir lib - - ps: > - cp C:\projects\mlpack\build\Release\*.lib - C:\projects\mlpack\dist\win-installer\staging\lib\ - - ps: > - cp C:\projects\mlpack\build\Release\*.exp - C:\projects\mlpack\dist\win-installer\staging\lib\ - - ps: > - cp C:\projects\mlpack\build\Release\*.dll - C:\projects\mlpack\dist\win-installer\staging\ - - ps: > - cp C:\projects\mlpack\build\Release\*.exe - C:\projects\mlpack\dist\win-installer\staging\ - - ps: > - cp C:\projects\mlpack\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll - C:\projects\mlpack\dist\win-installer\staging\ - - ps: > - cp C:\projects\mlpack\boost_libs\boost_unit_test_framework-vc*.dll - C:\projects\mlpack\dist\win-installer\staging\ - - ps: > - cp C:\projects\mlpack\build\include\mlpack - C:\projects\mlpack\dist\win-installer\staging -recurse - - ps: > - cp C:\projects\mlpack\doc\examples - C:\projects\mlpack\dist\win-installer\staging -recurse - - ps: > - cp C:\projects\mlpack\src\mlpack\tests\data\german.csv - C:\projects\mlpack\dist\win-installer\staging\examples\sample-ml-app\sample-ml-app\data\ - - # Checking current gitversion or mlpack version. - - ps: > - $ver = (Get-Content - "${env:APPVEYOR_BUILD_FOLDER}\src\mlpack\core\util\version.hpp" | - where {$_ -like "*MLPACK_VERSION*"}); - $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; - $env:MLPACK_VERSION += $ver[1].substring($ver[1].length - 1, 1) + '.'; - $env:MLPACK_VERSION += $ver[2].substring($ver[2].length - 1, 1); - - if (Test-Path ${env:GIT_VERSION_FILE}) - { - $ver = (Get-Content ${env:GIT_VERSION_FILE}); - $env:INSTALL_VERSION = $ver.Split('"')[1].Split(' ')[1]; - } - else - { - $env:INSTALL_VERSION = $env:MLPACK_VERSION; - } - - echo INSTALL_VERSION is %INSTALL_VERSION% - - # Building MSI installer. - - cd C:\projects\mlpack\dist\win-installer\mlpack-win-installer - - > - heat dir ..\staging - -cg HeatGenerated - -dr INSTALLFOLDER - -sreg - -srd - -var var.HarvestPath - -ag - -sfrag - -out HeatGeneratedFileList.wxs - - > - candle -dHarvestPath=..\staging - -dConfiguration=Release - -dOutDir=bin\x64\Release\ - -dPlatform=x64 - -dProjectDir=. - -dProjectExt=.wixproj - -dProjectFileName=mlpack-win-installer.wixproj - -dProjectName=mlpack-win-installer - -dProjectPath=mlpack-win-installer.wixproj - -dTargetDir=.\bin\x64\Release\ - -dTargetExt=.msi - -dTargetFileName=mlpack-windows.msi - -dTargetName=mlpack-windows - -dTargetPath=.\bin\x64\Release\mlpack-windows.msi - -out obj\x64\Release\ - -arch x64 - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" - Product.wxs HeatGeneratedFileList.wxs - - > - light -out .\bin\x64\Release\mlpack-%INSTALL_VERSION%.msi - -pdbout .\bin\x64\Release\mlpack-windows.wixpdb - -cultures:null - -loc mlpack-localization.wxl - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" - -contentsfile - obj\x64\Release\mlpack-win-installer.wixproj.BindContentsFileListnull.txt - -outputsfile - obj\x64\Release\mlpack-win-installer.wixproj.BindOutputsFileListnull.txt - -builtoutputsfile - obj\x64\Release\mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt - -wixprojectfile - mlpack-win-installer.wixproj - obj\x64\Release\Product.wixobj - obj\x64\Release\HeatGeneratedFileList.wixobj - -artifacts: - - path: 'build\*.zip' - name: mlpack-windows-zip - - - path: 'dist\win-installer\mlpack-win-installer\bin\x64\Release\*.msi' - name: mlpack-windows-installer - -notifications: -- provider: Email - to: - - mlpack-git@lists.mlpack.org - on_build_success: true - on_build_failure: true - on_build_status_changed: true - -cache: - - packages -> **\packages.config - - armadillo.tar.xz -> appveyor.yaml - -test_script: - # Copy all DLLs into the right place before running the test. - - ps: cp C:\projects\mlpack\boost_libs\*.* C:\projects\mlpack\build\ - - ps: > - cp C:\projects\mlpack\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.* - C:\projects\mlpack\build\ - - cd "%APPVEYOR_BUILD_FOLDER%/build/" - - > - Release\mlpack_test.exe - --report_level=detailed - --log_level=test_suite --log_format=XML > mlpack_test.xml & exit 0 - # Attempt to upload results to AppVeyor. - - ps: > - $wc = New-Object 'System.Net.WebClient'; - $wc.UploadFile( - "https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", - (Resolve-Path .\mlpack_test.xml)); From 45f80112eb4c438db835715ca6650685250bb571 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 8 Oct 2020 18:56:14 -0400 Subject: [PATCH 003/114] Temporarily disable Linux and OS X jobs. --- .ci/ci.yaml | 118 ++++++++++++++++++++++++++-------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/.ci/ci.yaml b/.ci/ci.yaml index 89adaec398..6354363894 100644 --- a/.ci/ci.yaml +++ b/.ci/ci.yaml @@ -8,65 +8,65 @@ pr: - '*' jobs: -- job: Linux - timeoutInMinutes: 360 - pool: - vmImage: ubuntu-16.04 - strategy: - matrix: - Plain: - CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' - Python: - binding: 'python' - python.version: '3.7' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' - Julia: - julia.version: '1.3.0' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_GO_BINDINGS=OFF -DJULIA_EXECUTABLE=/opt/julia-1.3.0/bin/julia -DBUILD_R_BINDINGS=OFF' - Go: - binding: 'go' - go.version: '1.11.0' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' - R: - binding: 'R' - R.version: '4.0.0' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=ON' - Markdown: - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_MARKDOWN_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' - - steps: - - template: linux-steps.yaml - -- job: macOS - timeoutInMinutes: 360 - pool: - vmImage: macOS-10.14 - strategy: - matrix: - Plain: - CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' - python.version: '2.7' - Python: - binding: 'python' - python.version: '3.7' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' - Julia: - python.version: '2.7' - julia.version: '1.3.0' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' - Go: - binding: 'go' - python.version: '2.7' - go.version: '1.11.0' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' - R: - binding: 'R' - python.version: '2.7' - R.version: '4.0.0' - CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=ON' - - steps: - - template: macos-steps.yaml +#- job: Linux +# timeoutInMinutes: 360 +# pool: +# vmImage: ubuntu-16.04 +# strategy: +# matrix: +# Plain: +# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' +# Python: +# binding: 'python' +# python.version: '3.7' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' +# Julia: +# julia.version: '1.3.0' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_GO_BINDINGS=OFF -DJULIA_EXECUTABLE=/opt/julia-1.3.0/bin/julia -DBUILD_R_BINDINGS=OFF' +# Go: +# binding: 'go' +# go.version: '1.11.0' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' +# R: +# binding: 'R' +# R.version: '4.0.0' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=ON' +# Markdown: +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_MARKDOWN_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' +# +# steps: +# - template: linux-steps.yaml +# +#- job: macOS +# timeoutInMinutes: 360 +# pool: +# vmImage: macOS-10.14 +# strategy: +# matrix: +# Plain: +# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' +# python.version: '2.7' +# Python: +# binding: 'python' +# python.version: '3.7' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' +# Julia: +# python.version: '2.7' +# julia.version: '1.3.0' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' +# Go: +# binding: 'go' +# python.version: '2.7' +# go.version: '1.11.0' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' +# R: +# binding: 'R' +# python.version: '2.7' +# R.version: '4.0.0' +# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=ON' +# +# steps: +# - template: macos-steps.yaml - job: WindowsVS15 timeoutInMinutes: 360 From 7aaf1d74820bb3e4959440dc9402a5ad6b486790 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 8 Oct 2020 21:39:09 -0400 Subject: [PATCH 004/114] Try to fix syntax. --- .ci/windows-steps.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 8cf26046fe..18bd50a0e5 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -152,12 +152,10 @@ steps: cp doc\examples dist\win-installer\staging -recurse cp src\mlpack\tests\data\german.csv dist\win-installer\staging\examples\sample-ml-app\sample-ml-app\data\ # Check current git version or mlpack version. - $ver = (Get-Content - "src\mlpack\core\util\version.hpp" | - where {$_ -like "*MLPACK_VERSION*"}); - $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; - $env:MLPACK_VERSION += $ver[1].substring($ver[1].length - 1, 1) + '.'; - $env:MLPACK_VERSION += $ver[2].substring($ver[2].length - 1, 1); + $ver = (Get-Content "src\mlpack\core\util\version.hpp" where {$_ -like "*MLPACK_VERSION*"}); + $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; + $env:MLPACK_VERSION += $ver[1].substring($ver[1].length - 1, 1) + '.'; + $env:MLPACK_VERSION += $ver[2].substring($ver[2].length - 1, 1); if (Test-Path "src/mlpack/core/util/gitversion.hpp") { From 58edc52e7047dec05e8a8903b8770fa7aafe4f0f Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 9 Oct 2020 10:49:06 -0400 Subject: [PATCH 005/114] Maybe we need the pipe? --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 18bd50a0e5..fc5d5f9ab7 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -152,7 +152,7 @@ steps: cp doc\examples dist\win-installer\staging -recurse cp src\mlpack\tests\data\german.csv dist\win-installer\staging\examples\sample-ml-app\sample-ml-app\data\ # Check current git version or mlpack version. - $ver = (Get-Content "src\mlpack\core\util\version.hpp" where {$_ -like "*MLPACK_VERSION*"}); + $ver = (Get-Content "src\mlpack\core\util\version.hpp" | where {$_ -like "*MLPACK_VERSION*"}); $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; $env:MLPACK_VERSION += $ver[1].substring($ver[1].length - 1, 1) + '.'; $env:MLPACK_VERSION += $ver[2].substring($ver[2].length - 1, 1); From f36060d47d6556aab1328390a592e52b2b7a1eee Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 9 Oct 2020 19:56:56 -0400 Subject: [PATCH 006/114] Try to fix a few bugs. --- .ci/windows-steps.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index fc5d5f9ab7..d644f6345f 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -126,7 +126,7 @@ steps: - powershell: | # Pull the documentation for the installer. try { - (new-object net.webclient).DownloadFile(${env:JENKINS_DOC_DOWNLOAD}, + (new-object net.webclient).DownloadFile('http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip'), 'dist\win-installer\jenkinsdoc.zip') } catch { @@ -134,7 +134,7 @@ steps: } try { (Add-Type -AssemblyName System.IO.Compression.FileSystem); - [System.IO.Compression.ZipFile]::ExtractToDirectory(${env:JENKINS_DOC}, + [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\staging\doc') } catch { @@ -159,7 +159,7 @@ steps: if (Test-Path "src/mlpack/core/util/gitversion.hpp") { - $ver = (Get-Content ${env:GIT_VERSION_FILE}); + $ver = (Get-Content "src/mlpack/core/util/gitversion.hpp" $env:INSTALL_VERSION = $ver.Split('"')[1].Split(' ')[1]; } else From 332c0c56d751a14147da90f03f98153af3059351 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 9 Oct 2020 23:11:38 -0400 Subject: [PATCH 007/114] Some additional syntax fixes (I hope...). --- .ci/windows-steps.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index d644f6345f..b317a0497c 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -126,8 +126,7 @@ steps: - powershell: | # Pull the documentation for the installer. try { - (new-object net.webclient).DownloadFile('http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip'), - 'dist\win-installer\jenkinsdoc.zip') + (new-object net.webclient).DownloadFile('http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip'), 'dist\win-installer\jenkinsdoc.zip') } catch { Write-Output "Unable to download precompiled Doxygen documentation from Jenkins!" @@ -159,7 +158,7 @@ steps: if (Test-Path "src/mlpack/core/util/gitversion.hpp") { - $ver = (Get-Content "src/mlpack/core/util/gitversion.hpp" + $ver = (Get-Content "src/mlpack/core/util/gitversion.hpp"); $env:INSTALL_VERSION = $ver.Split('"')[1].Split(' ')[1]; } else From 7fdc820181e70a2d14c330980ac19ebc498aabfc Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 10 Oct 2020 13:59:50 -0400 Subject: [PATCH 008/114] Okay, does it all need to be on one line? --- .ci/windows-steps.yaml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index b317a0497c..82343803d1 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -125,20 +125,10 @@ steps: # Build MSI installer. - powershell: | # Pull the documentation for the installer. - try { - (new-object net.webclient).DownloadFile('http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip'), 'dist\win-installer\jenkinsdoc.zip') - } - catch { - Write-Output "Unable to download precompiled Doxygen documentation from Jenkins!" - } - try { - (Add-Type -AssemblyName System.IO.Compression.FileSystem); - [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', - 'dist\win-installer\staging\doc') - } - catch { - Write-Output "Unable to add doc to installer, skipping!" - } + try{(new-object net.webclient).DownloadFile('http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip'), 'dist\win-installer\jenkinsdoc.zip')} + catch{Write-Output "Unable to download precompiled Doxygen documentation from Jenkins!"} + try {(Add-Type -AssemblyName System.IO.Compression.FileSystem); [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\staging\doc')} + catch{Write-Output "Unable to add doc to installer, skipping!"} # Preparing installer staging. mkdir dist\win-installer\staging\lib cp build\Release\*.lib dist\win-installer\staging\lib\ From f63615c458b677b2ad33e6559f968afa701c82da Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 10 Oct 2020 17:01:54 -0400 Subject: [PATCH 009/114] Okay, maybe this syntax is okay? --- .ci/windows-steps.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 82343803d1..69734a9d1a 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -125,9 +125,17 @@ steps: # Build MSI installer. - powershell: | # Pull the documentation for the installer. - try{(new-object net.webclient).DownloadFile('http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip'), 'dist\win-installer\jenkinsdoc.zip')} - catch{Write-Output "Unable to download precompiled Doxygen documentation from Jenkins!"} - try {(Add-Type -AssemblyName System.IO.Compression.FileSystem); [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\staging\doc')} + try { + $url = "http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip" + (new-object net.webclient).DownloadFile($url), 'dist\win-installer\jenkinsdoc.zip') + } + catch { + Write-Output "Unable to download precompiled Doxygen documentation from Jenkins!" + } + try { + (Add-Type -AssemblyName System.IO.Compression.FileSystem); + [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\staging\doc') + } catch{Write-Output "Unable to add doc to installer, skipping!"} # Preparing installer staging. mkdir dist\win-installer\staging\lib From 989ce6c911be499aa1a2e0f6546163355fbc5b5e Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 11 Oct 2020 10:12:54 -0400 Subject: [PATCH 010/114] Ok, oops, I had one too many ); that should have been obvious... --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 69734a9d1a..4cc616dd30 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -127,7 +127,7 @@ steps: # Pull the documentation for the installer. try { $url = "http://ci.mlpack.org/job/mlpack%20-%20doxygen%20build/lastSuccessfulBuild/artifact/build/doc/html/*zip*/html.zip" - (new-object net.webclient).DownloadFile($url), 'dist\win-installer\jenkinsdoc.zip') + (new-object net.webclient).DownloadFile($url, 'dist\win-installer\jenkinsdoc.zip') } catch { Write-Output "Unable to download precompiled Doxygen documentation from Jenkins!" From 8ef8f94ce59b699bfe95711771a9d17ba26b6ac7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 11 Oct 2020 13:10:17 -0400 Subject: [PATCH 011/114] Hey, getting somewhere! Now there is a path issue. --- .ci/windows-steps.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 4cc616dd30..7ec2c38120 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -164,6 +164,8 @@ steps: $env:INSTALL_VERSION = $env:MLPACK_VERSION; } # Build the MSI installer. + dir C:\Program Files (x86)\ + set path=C:\Program Files (x86)\WiX Toolset v3.11\bin;%path% cd dist\win-installer\mlpack-win-installer heat dir ..\staging -cg HeatGenerated From 4435692182cd45db2717006be4b0b436e37d4ad2 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 11 Oct 2020 20:25:15 -0400 Subject: [PATCH 012/114] Try escaping the string. --- .ci/windows-steps.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 7ec2c38120..e45fb26eb6 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -164,8 +164,8 @@ steps: $env:INSTALL_VERSION = $env:MLPACK_VERSION; } # Build the MSI installer. - dir C:\Program Files (x86)\ - set path=C:\Program Files (x86)\WiX Toolset v3.11\bin;%path% + dir "C:\Program Files (x86)\" + set path="C:\Program Files (x86)\WiX Toolset v3.11\bin";%path% cd dist\win-installer\mlpack-win-installer heat dir ..\staging -cg HeatGenerated From c333b69ecc8e84a651db2c7cf579cf40259de3bb Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 12 Oct 2020 09:50:00 -0400 Subject: [PATCH 013/114] Maybe with powershell I get the path with $path not %path%? --- .ci/windows-steps.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index e45fb26eb6..f86cf73d1d 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -164,8 +164,7 @@ steps: $env:INSTALL_VERSION = $env:MLPACK_VERSION; } # Build the MSI installer. - dir "C:\Program Files (x86)\" - set path="C:\Program Files (x86)\WiX Toolset v3.11\bin";%path% + set path="C:\Program Files (x86)\WiX Toolset v3.11\bin";$path cd dist\win-installer\mlpack-win-installer heat dir ..\staging -cg HeatGenerated From 17a5777263bf244d811fb0722a41e32eb262fdd3 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 12 Oct 2020 12:50:44 -0400 Subject: [PATCH 014/114] Maybe this gets us closer with the path? --- .ci/windows-steps.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index f86cf73d1d..7d1c267821 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -164,8 +164,10 @@ steps: $env:INSTALL_VERSION = $env:MLPACK_VERSION; } # Build the MSI installer. - set path="C:\Program Files (x86)\WiX Toolset v3.11\bin";$path + $env:Path += "C:\Program Files (x86)\WiX Toolset v3.11\bin" cd dist\win-installer\mlpack-win-installer + dir "C:\Program Files (x86)\WiX Toolset v3.11\" + dir "C:\Program Files (x86)\WiX Toolset v3.11\bin\" heat dir ..\staging -cg HeatGenerated -dr INSTALLFOLDER From 4cb5e7ffce1ddc7d30ace5e8d83a63349c64cb93 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 12 Oct 2020 15:09:37 -0400 Subject: [PATCH 015/114] Ok, forget the path, just specify directly. --- .ci/windows-steps.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 7d1c267821..9519ef4699 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -164,11 +164,8 @@ steps: $env:INSTALL_VERSION = $env:MLPACK_VERSION; } # Build the MSI installer. - $env:Path += "C:\Program Files (x86)\WiX Toolset v3.11\bin" cd dist\win-installer\mlpack-win-installer - dir "C:\Program Files (x86)\WiX Toolset v3.11\" - dir "C:\Program Files (x86)\WiX Toolset v3.11\bin\" - heat dir ..\staging + "C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" dir ..\staging -cg HeatGenerated -dr INSTALLFOLDER -sreg @@ -177,7 +174,7 @@ steps: -ag -sfrag -out HeatGeneratedFileList.wxs - candle + "C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" -dHarvestPath=..\staging -dConfiguration=Release -dOutDir=bin\x64\Release\ @@ -196,7 +193,7 @@ steps: -arch x64 -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" Product.wxs HeatGeneratedFileList.wxs - light + "C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" -out .\bin\x64\Release\mlpack-%INSTALL_VERSION%.msi -pdbout .\bin\x64\Release\mlpack-windows.wixpdb -cultures:null From 42aae59d1071f7c302c8eb2318a8db1c855afd7c Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 12 Oct 2020 19:00:42 -0400 Subject: [PATCH 016/114] Seriously? Backticks for line continuation? --- .ci/windows-steps.yaml | 72 +++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 9519ef4699..37908bc2be 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -165,44 +165,44 @@ steps: } # Build the MSI installer. cd dist\win-installer\mlpack-win-installer - "C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" dir ..\staging - -cg HeatGenerated - -dr INSTALLFOLDER - -sreg - -srd - -var var.HarvestPath - -ag - -sfrag + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ..\staging ` + -cg HeatGenerated ` + -dr INSTALLFOLDER ` + -sreg ` + -srd ` + -var var.HarvestPath ` + -ag ` + -sfrag ` -out HeatGeneratedFileList.wxs - "C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" - -dHarvestPath=..\staging - -dConfiguration=Release - -dOutDir=bin\x64\Release\ - -dPlatform=x64 - -dProjectDir=. - -dProjectExt=.wixproj - -dProjectFileName=mlpack-win-installer.wixproj - -dProjectName=mlpack-win-installer - -dProjectPath=mlpack-win-installer.wixproj - -dTargetDir=.\bin\x64\Release\ - -dTargetExt=.msi - -dTargetFileName=mlpack-windows.msi - -dTargetName=mlpack-windows - -dTargetPath=.\bin\x64\Release\mlpack-windows.msi - -out obj\x64\Release\ - -arch x64 - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + -dHarvestPath=..\staging ` + -dConfiguration=Release ` + -dOutDir=bin\x64\Release\ ` + -dPlatform=x64 ` + -dProjectDir=. ` + -dProjectExt=.wixproj ` + -dProjectFileName=mlpack-win-installer.wixproj ` + -dProjectName=mlpack-win-installer ` + -dProjectPath=mlpack-win-installer.wixproj ` + -dTargetDir=.\bin\x64\Release\ ` + -dTargetExt=.msi ` + -dTargetFileName=mlpack-windows.msi ` + -dTargetName=mlpack-windows ` + -dTargetPath=.\bin\x64\Release\mlpack-windows.msi ` + -out obj\x64\Release\ ` + -arch x64 ` + -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` Product.wxs HeatGeneratedFileList.wxs - "C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" - -out .\bin\x64\Release\mlpack-%INSTALL_VERSION%.msi - -pdbout .\bin\x64\Release\mlpack-windows.wixpdb - -cultures:null - -loc mlpack-localization.wxl - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" - -contentsfile obj\x64\Release\mlpack-win-installer.wixproj.BindContentsFileListnull.txt - -outputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindOutputsFileListnull.txt - -builtoutputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt - -wixprojectfile mlpack-win-installer.wixproj + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` + -out .\bin\x64\Release\mlpack-%INSTALL_VERSION%.msi ` + -pdbout .\bin\x64\Release\mlpack-windows.wixpdb ` + -cultures:null ` + -loc mlpack-localization.wxl ` + -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` + -contentsfile obj\x64\Release\mlpack-win-installer.wixproj.BindContentsFileListnull.txt ` + -outputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindOutputsFileListnull.txt ` + -builtoutputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt ` + -wixprojectfile mlpack-win-installer.wixproj ` obj\x64\Release\Product.wixobj obj\x64\Release\HeatGeneratedFileList.wixobj displayName: 'Build MSI Windows installer' From abd258eceeda09beea5acb8ad92fba43d1fbd2f0 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 13 Oct 2020 08:32:48 -0400 Subject: [PATCH 017/114] Maybe the directory did not exist? --- .ci/windows-steps.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 37908bc2be..a602584a4f 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -164,7 +164,10 @@ steps: $env:INSTALL_VERSION = $env:MLPACK_VERSION; } # Build the MSI installer. + dir + mkdir dist\win-installer\mlpack-win-installer cd dist\win-installer\mlpack-win-installer + dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ..\staging ` -cg HeatGenerated ` -dr INSTALLFOLDER ` From 6432d576e5ffa4745f1e41d26edebd1f80944439 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 13 Oct 2020 11:08:21 -0400 Subject: [PATCH 018/114] Ok, the directory already exists. --- .ci/windows-steps.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index a602584a4f..3198f90a6a 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -165,7 +165,6 @@ steps: } # Build the MSI installer. dir - mkdir dist\win-installer\mlpack-win-installer cd dist\win-installer\mlpack-win-installer dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ..\staging ` From 31750b1786b6332b43d805f0511113699f271ff5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 13 Oct 2020 15:18:06 -0400 Subject: [PATCH 019/114] Could this be a \ vs. / issue? --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 3198f90a6a..40b4652901 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -167,7 +167,7 @@ steps: dir cd dist\win-installer\mlpack-win-installer dir - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ..\staging ` + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ../staging ` -cg HeatGenerated ` -dr INSTALLFOLDER ` -sreg ` From cc7431f019d7fbd99f3e91e9dee7c651fb4720d6 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 13 Oct 2020 21:49:19 -0400 Subject: [PATCH 020/114] More \ vs. / nonsense. --- .ci/windows-steps.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 40b4652901..72e1d99597 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -177,35 +177,35 @@ steps: -sfrag ` -out HeatGeneratedFileList.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - -dHarvestPath=..\staging ` + -dHarvestPath=../staging ` -dConfiguration=Release ` - -dOutDir=bin\x64\Release\ ` + -dOutDir=bin/x64/Release/ ` -dPlatform=x64 ` -dProjectDir=. ` -dProjectExt=.wixproj ` -dProjectFileName=mlpack-win-installer.wixproj ` -dProjectName=mlpack-win-installer ` -dProjectPath=mlpack-win-installer.wixproj ` - -dTargetDir=.\bin\x64\Release\ ` + -dTargetDir=./bin/x64/Release/ ` -dTargetExt=.msi ` -dTargetFileName=mlpack-windows.msi ` -dTargetName=mlpack-windows ` - -dTargetPath=.\bin\x64\Release\mlpack-windows.msi ` - -out obj\x64\Release\ ` + -dTargetPath=./bin/x64/Release/mlpack-windows.msi ` + -out obj/x64/Release/ ` -arch x64 ` -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` Product.wxs HeatGeneratedFileList.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` - -out .\bin\x64\Release\mlpack-%INSTALL_VERSION%.msi ` - -pdbout .\bin\x64\Release\mlpack-windows.wixpdb ` + -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` + -pdbout ./bin/x64/Release/mlpack-windows.wixpdb ` -cultures:null ` -loc mlpack-localization.wxl ` -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` - -contentsfile obj\x64\Release\mlpack-win-installer.wixproj.BindContentsFileListnull.txt ` - -outputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindOutputsFileListnull.txt ` - -builtoutputsfile obj\x64\Release\mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt ` + -contentsfile obj/x64/Release/mlpack-win-installer.wixproj.BindContentsFileListnull.txt ` + -outputsfile obj/x64/Release/mlpack-win-installer.wixproj.BindOutputsFileListnull.txt ` + -builtoutputsfile obj/x64/Release/mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt ` -wixprojectfile mlpack-win-installer.wixproj ` - obj\x64\Release\Product.wixobj obj\x64\Release\HeatGeneratedFileList.wixobj + obj/x64/Release/Product.wixobj obj\x64\Release\HeatGeneratedFileList.wixobj displayName: 'Build MSI Windows installer' # Publish artifacts to Azure Pipelines From 24a5f8b1a3b57c8384de3fc697db201e8e09d5c9 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 14 Oct 2020 09:59:23 -0400 Subject: [PATCH 021/114] Okay, maybe I can get some documentation on candle.exe? --- .ci/windows-steps.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 72e1d99597..473d9fbfab 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -176,6 +176,7 @@ steps: -ag ` -sfrag ` -out HeatGeneratedFileList.wxs + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' -? & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` -dHarvestPath=../staging ` -dConfiguration=Release ` From 51814aa34a9f50bdf28e520bb425cd770bbea1b3 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 14 Oct 2020 17:00:25 -0400 Subject: [PATCH 022/114] What files are in the directory? --- .ci/windows-steps.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 473d9fbfab..c78530f62b 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -177,6 +177,7 @@ steps: -sfrag ` -out HeatGeneratedFileList.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' -? + dir ../staging & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` -dHarvestPath=../staging ` -dConfiguration=Release ` From 5b1104ad49bc85025d8ded72d9ccf0962b624941 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 15 Oct 2020 10:49:21 -0400 Subject: [PATCH 023/114] What if I just remove HarvestPath? --- .ci/windows-steps.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index c78530f62b..5748e4da71 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -179,7 +179,6 @@ steps: & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' -? dir ../staging & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - -dHarvestPath=../staging ` -dConfiguration=Release ` -dOutDir=bin/x64/Release/ ` -dPlatform=x64 ` From 9d313b77ae84cae503b1c637aa6590cc5c8d19fc Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 15 Oct 2020 13:53:37 -0400 Subject: [PATCH 024/114] I dunno, this is just a random guess... --- .ci/windows-steps.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 5748e4da71..18f91135eb 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -179,6 +179,8 @@ steps: & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' -? dir ../staging & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + mlpack-wix-installer.wixproj Product.wxs HeatGeneratedFileList.wxs ` + -dHarvestPath=../staging/ ` -dConfiguration=Release ` -dOutDir=bin/x64/Release/ ` -dPlatform=x64 ` @@ -194,8 +196,7 @@ steps: -dTargetPath=./bin/x64/Release/mlpack-windows.msi ` -out obj/x64/Release/ ` -arch x64 ` - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` - Product.wxs HeatGeneratedFileList.wxs + -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` -pdbout ./bin/x64/Release/mlpack-windows.wixpdb ` From 7487eb6c7efef9e3ae05ce9d3b1eb49bd647f0d7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 16 Oct 2020 11:00:10 -0400 Subject: [PATCH 025/114] Fix the spelling... --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 18f91135eb..c5ddef9926 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -179,7 +179,7 @@ steps: & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' -? dir ../staging & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - mlpack-wix-installer.wixproj Product.wxs HeatGeneratedFileList.wxs ` + mlpack-win-installer.wixproj Product.wxs HeatGeneratedFileList.wxs ` -dHarvestPath=../staging/ ` -dConfiguration=Release ` -dOutDir=bin/x64/Release/ ` From dac38224a7e348e22f98b41e36378eb330d8430e Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 16 Oct 2020 17:10:45 -0400 Subject: [PATCH 026/114] Try removing HarvestPath again. --- .ci/windows-steps.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index c5ddef9926..0edae83723 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -180,7 +180,6 @@ steps: dir ../staging & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` mlpack-win-installer.wixproj Product.wxs HeatGeneratedFileList.wxs ` - -dHarvestPath=../staging/ ` -dConfiguration=Release ` -dOutDir=bin/x64/Release/ ` -dPlatform=x64 ` From bbfab574bf030ece756dc1059ba16bab5f8d87f8 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 16 Oct 2020 19:53:34 -0400 Subject: [PATCH 027/114] Maybe this gets us closer? I really have no idea. --- .ci/windows-steps.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 0edae83723..08b0da9394 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -184,7 +184,6 @@ steps: -dOutDir=bin/x64/Release/ ` -dPlatform=x64 ` -dProjectDir=. ` - -dProjectExt=.wixproj ` -dProjectFileName=mlpack-win-installer.wixproj ` -dProjectName=mlpack-win-installer ` -dProjectPath=mlpack-win-installer.wixproj ` From 2f3a8d7ff1bf4416153e54a68ff3abcf0e5eefbb Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 16 Oct 2020 19:54:13 -0400 Subject: [PATCH 028/114] Disable VS15 build. --- .ci/ci.yaml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.ci/ci.yaml b/.ci/ci.yaml index 09357c716e..7a02c0de62 100644 --- a/.ci/ci.yaml +++ b/.ci/ci.yaml @@ -59,21 +59,22 @@ jobs: # steps: # - template: macos-steps.yaml -- job: WindowsVS15 - timeoutInMinutes: 360 - displayName: Windows VS15 - pool: - vmImage: vs2017-win2016 - strategy: - matrix: - Plain: - CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' - python.version: '2.7' - CMakeGenerator: '-G "Visual Studio 15 2017 Win64"' - MSBuildVersion: '15.0' - ArchiveNoLibs: 'mlpack-windows-vs15-no-libs.zip' - ArchiveLibs: 'mlpack-windows-vs15.zip' - ArchiveTests: 'mlpack_test-vs15.xml' +# Typically gives a C1060... +#- job: WindowsVS15 +# timeoutInMinutes: 360 +# displayName: Windows VS15 +# pool: +# vmImage: vs2017-win2016 +# strategy: +# matrix: +# Plain: +# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' +# python.version: '2.7' +# CMakeGenerator: '-G "Visual Studio 15 2017 Win64"' +# MSBuildVersion: '15.0' +# ArchiveNoLibs: 'mlpack-windows-vs15-no-libs.zip' +# ArchiveLibs: 'mlpack-windows-vs15.zip' +# ArchiveTests: 'mlpack_test-vs15.xml' steps: - template: windows-steps.yaml From fd7af11d2c0a660ff5a5e719d93948e09a117504 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 17 Oct 2020 14:28:13 -0400 Subject: [PATCH 029/114] What is even in this file? --- .ci/windows-steps.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 08b0da9394..cfc7ce5fd8 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -178,6 +178,7 @@ steps: -out HeatGeneratedFileList.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' -? dir ../staging + type Product.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` mlpack-win-installer.wixproj Product.wxs HeatGeneratedFileList.wxs ` -dConfiguration=Release ` From 133405989800bad0f876d611b042e6136bf210c5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 17 Oct 2020 18:09:16 -0400 Subject: [PATCH 030/114] At this point it's just genetic algorithms. --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index cfc7ce5fd8..5fbd4c25c0 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -180,7 +180,7 @@ steps: dir ../staging type Product.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - mlpack-win-installer.wixproj Product.wxs HeatGeneratedFileList.wxs ` + Product.wxs HeatGeneratedFileList.wxs ` -dConfiguration=Release ` -dOutDir=bin/x64/Release/ ` -dPlatform=x64 ` From 497957346b73665cad135ce5ec5f58e254d2bdd4 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 17 Oct 2020 21:46:36 -0400 Subject: [PATCH 031/114] Try following some tutorial I found a little bit. --- .ci/windows-steps.yaml | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 5fbd4c25c0..77486cb3a1 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -168,34 +168,16 @@ steps: cd dist\win-installer\mlpack-win-installer dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ../staging ` - -cg HeatGenerated ` -dr INSTALLFOLDER ` - -sreg ` - -srd ` - -var var.HarvestPath ` - -ag ` - -sfrag ` - -out HeatGeneratedFileList.wxs - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' -? + -cg HeatGenerated ` + -g1 -gg -sf -srd -scom -sreg ` + -out fragment.wxs dir ../staging - type Product.wxs + dir + type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - Product.wxs HeatGeneratedFileList.wxs ` - -dConfiguration=Release ` - -dOutDir=bin/x64/Release/ ` - -dPlatform=x64 ` - -dProjectDir=. ` - -dProjectFileName=mlpack-win-installer.wixproj ` - -dProjectName=mlpack-win-installer ` - -dProjectPath=mlpack-win-installer.wixproj ` - -dTargetDir=./bin/x64/Release/ ` - -dTargetExt=.msi ` - -dTargetFileName=mlpack-windows.msi ` - -dTargetName=mlpack-windows ` - -dTargetPath=./bin/x64/Release/mlpack-windows.msi ` + Product.wxs fragment.wxs ` -out obj/x64/Release/ ` - -arch x64 ` - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` -pdbout ./bin/x64/Release/mlpack-windows.wixpdb ` From 78888bbbc3c97b85a6aca6b2a44cd0d1dda26759 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 18 Oct 2020 11:43:26 -0400 Subject: [PATCH 032/114] Oops, remove accidental backtick. --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 77486cb3a1..bc021fe5db 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -177,7 +177,7 @@ steps: type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` Product.wxs fragment.wxs ` - -out obj/x64/Release/ ` + -out obj/x64/Release/ & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` -pdbout ./bin/x64/Release/mlpack-windows.wixpdb ` From c6a8f796e447b307662a37d36ef32f3e0e91af17 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 19 Oct 2020 11:51:29 -0400 Subject: [PATCH 033/114] I wonder what will happen now? --- .ci/windows-steps.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index bc021fe5db..e0fd98d7d0 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -178,6 +178,7 @@ steps: & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` Product.wxs fragment.wxs ` -out obj/x64/Release/ + dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` -pdbout ./bin/x64/Release/mlpack-windows.wixpdb ` @@ -188,7 +189,7 @@ steps: -outputsfile obj/x64/Release/mlpack-win-installer.wixproj.BindOutputsFileListnull.txt ` -builtoutputsfile obj/x64/Release/mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt ` -wixprojectfile mlpack-win-installer.wixproj ` - obj/x64/Release/Product.wixobj obj\x64\Release\HeatGeneratedFileList.wixobj + obj/x64/Release/Product.wixobj obj\x64\Release\fragment.wixobj displayName: 'Build MSI Windows installer' # Publish artifacts to Azure Pipelines From 2667a564f56f417019f5eea31d3efb38e7ffa6d5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 20 Oct 2020 09:27:28 -0400 Subject: [PATCH 034/114] Try to use the default "SourceDir". --- .ci/windows-steps.yaml | 26 +++++++++---------- .../mlpack-win-installer.wixproj | 5 +--- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index e0fd98d7d0..26d66754ab 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -134,20 +134,20 @@ steps: } try { (Add-Type -AssemblyName System.IO.Compression.FileSystem); - [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\staging\doc') + [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\SourceDir\doc') } catch{Write-Output "Unable to add doc to installer, skipping!"} # Preparing installer staging. - mkdir dist\win-installer\staging\lib - cp build\Release\*.lib dist\win-installer\staging\lib\ - cp build\Release\*.exp dist\win-installer\staging\lib\ - cp build\Release\*.dll dist\win-installer\staging\ - cp build\Release\*.exe dist\win-installer\staging\ - cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\staging\ - cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\staging\ - cp build\include\mlpack dist\win-installer\staging -recurse - cp doc\examples dist\win-installer\staging -recurse - cp src\mlpack\tests\data\german.csv dist\win-installer\staging\examples\sample-ml-app\sample-ml-app\data\ + mkdir dist\win-installer\SourceDir\lib + cp build\Release\*.lib dist\win-installer\SourceDir\lib\ + cp build\Release\*.exp dist\win-installer\SourceDir\lib\ + cp build\Release\*.dll dist\win-installer\SourceDir\ + cp build\Release\*.exe dist\win-installer\SourceDir\ + cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\SourceDir\ + cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\SourceDir\ + cp build\include\mlpack dist\win-installer\SourceDir -recurse + cp doc\examples dist\win-installer\SourceDir -recurse + cp src\mlpack\tests\data\german.csv dist\win-installer\SourceDir\examples\sample-ml-app\sample-ml-app\data\ # Check current git version or mlpack version. $ver = (Get-Content "src\mlpack\core\util\version.hpp" | where {$_ -like "*MLPACK_VERSION*"}); $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; @@ -167,12 +167,12 @@ steps: dir cd dist\win-installer\mlpack-win-installer dir - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ../staging ` + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ../SourceDir ` -dr INSTALLFOLDER ` -cg HeatGenerated ` -g1 -gg -sf -srd -scom -sreg ` -out fragment.wxs - dir ../staging + dir ../SourceDir dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 8795a920eb..c0e9d9fd0d 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -28,9 +28,6 @@ bin\$(Platform)\$(Configuration)\ obj\$(Platform)\$(Configuration)\ - - HarvestPath=..\staging - @@ -56,4 +53,4 @@ --> - \ No newline at end of file + From d4fe9f7c937f5845505ca0ec98e0aba6514338b3 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 21 Oct 2020 09:14:23 -0400 Subject: [PATCH 035/114] Try making SourceDir a subdirectory of mlpack-win-installer. --- .ci/windows-steps.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 26d66754ab..0a8729c5b9 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -134,20 +134,20 @@ steps: } try { (Add-Type -AssemblyName System.IO.Compression.FileSystem); - [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\SourceDir\doc') + [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\mlpack-win-installer\SourceDir\doc') } catch{Write-Output "Unable to add doc to installer, skipping!"} # Preparing installer staging. - mkdir dist\win-installer\SourceDir\lib - cp build\Release\*.lib dist\win-installer\SourceDir\lib\ - cp build\Release\*.exp dist\win-installer\SourceDir\lib\ - cp build\Release\*.dll dist\win-installer\SourceDir\ - cp build\Release\*.exe dist\win-installer\SourceDir\ - cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\SourceDir\ - cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\SourceDir\ - cp build\include\mlpack dist\win-installer\SourceDir -recurse - cp doc\examples dist\win-installer\SourceDir -recurse - cp src\mlpack\tests\data\german.csv dist\win-installer\SourceDir\examples\sample-ml-app\sample-ml-app\data\ + mkdir dist\win-installer\mlpack-win-installer\SourceDir\lib + cp build\Release\*.lib dist\win-installer\mlpack-win-installer\SourceDir\lib\ + cp build\Release\*.exp dist\win-installer\mlpack-win-installer\SourceDir\lib\ + cp build\Release\*.dll dist\win-installer\mlpack-win-installer\SourceDir\ + cp build\Release\*.exe dist\win-installer\mlpack-win-installer\SourceDir\ + cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\mlpack-win-installer\SourceDir\ + cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\mlpack-win-installer\SourceDir\ + cp build\include\mlpack dist\win-installer\mlpack-win-installer\SourceDir -recurse + cp doc\examples dist\win-installer\mlpack-win-installer\SourceDir -recurse + cp src\mlpack\tests\data\german.csv dist\win-installer\mlpack-win-installer\SourceDir\examples\sample-ml-app\sample-ml-app\data\ # Check current git version or mlpack version. $ver = (Get-Content "src\mlpack\core\util\version.hpp" | where {$_ -like "*MLPACK_VERSION*"}); $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; @@ -167,12 +167,12 @@ steps: dir cd dist\win-installer\mlpack-win-installer dir - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir ../SourceDir ` + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir SourceDir ` -dr INSTALLFOLDER ` -cg HeatGenerated ` -g1 -gg -sf -srd -scom -sreg ` -out fragment.wxs - dir ../SourceDir + dir SourceDir dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` From 7d81636848921a6953dfd5c76bc36472f20f50b2 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 27 Oct 2020 14:07:42 -0400 Subject: [PATCH 036/114] Try re-adding HarvestPath. --- .../mlpack-win-installer/mlpack-win-installer.wixproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index c0e9d9fd0d..f677291fb9 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -43,6 +43,9 @@ + + HarvestPath=.\SourceDir + From 66c21a9511a2358e8b871ce211b066a5fe63a90c Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 31 Oct 2020 10:48:59 -0400 Subject: [PATCH 037/114] Just try simplifying some things... --- .ci/windows-steps.yaml | 29 +++++---- .../mlpack-win-installer.wixproj | 59 ------------------- 2 files changed, 16 insertions(+), 72 deletions(-) delete mode 100644 dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 0a8729c5b9..17171592b8 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -169,27 +169,30 @@ steps: dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir SourceDir ` -dr INSTALLFOLDER ` - -cg HeatGenerated ` - -g1 -gg -sf -srd -scom -sreg ` + -ag ` + -cg DynamicFragment ` + -ke ` + -srd ` + -sfrag ` + -nologo ` -out fragment.wxs dir SourceDir dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - Product.wxs fragment.wxs ` - -out obj/x64/Release/ + -out obj/x64/Release/Product.wixobj ` + Product.wxs + & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + -out obj/x64/Release/fragment.wixobj ` + fragment.wxs dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` + -b SourceDir ` + obj/x64/Release/Product.wixobj ` + obj\x64\Release\fragment.wixobj ` -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` - -pdbout ./bin/x64/Release/mlpack-windows.wixpdb ` - -cultures:null ` - -loc mlpack-localization.wxl ` - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` - -contentsfile obj/x64/Release/mlpack-win-installer.wixproj.BindContentsFileListnull.txt ` - -outputsfile obj/x64/Release/mlpack-win-installer.wixproj.BindOutputsFileListnull.txt ` - -builtoutputsfile obj/x64/Release/mlpack-win-installer.wixproj.BindBuiltOutputsFileListnull.txt ` - -wixprojectfile mlpack-win-installer.wixproj ` - obj/x64/Release/Product.wixobj obj\x64\Release\fragment.wixobj + -loc mlpack-localization.wxl + -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" displayName: 'Build MSI Windows installer' # Publish artifacts to Azure Pipelines diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj deleted file mode 100644 index f677291fb9..0000000000 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ /dev/null @@ -1,59 +0,0 @@ - - - - Debug - x86 - 3.10 - 5409c191-c4b0-4caf-954c-001bb5c1d136 - 2.0 - mlpack-windows - Package - mlpack-win-installer - - - bin\$(Configuration)\ - obj\$(Configuration)\ - Debug - - - bin\$(Configuration)\ - obj\$(Configuration)\ - - - Debug - bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - bin\$(Platform)\$(Configuration)\ - obj\$(Platform)\$(Configuration)\ - - - - - - - - $(WixExtDir)\WixUIExtension.dll - WixUIExtension - - - - - - - - - HarvestPath=.\SourceDir - - - - - - - From cf1f70261343c0a4c4a78ebb33260328060a955b Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 2 Nov 2020 08:53:45 -0500 Subject: [PATCH 038/114] Re-add .wixproj file... will it do anything? --- .../mlpack-win-installer.wixproj | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj new file mode 100644 index 0000000000..b82fa1b8f1 --- /dev/null +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -0,0 +1,59 @@ + + + + Debug + x86 + 3.10 + 5409c191-c4b0-4caf-954c-001bb5c1d136 + 2.0 + mlpack-windows + Package + mlpack-win-installer + + + bin\$(Configuration)\ + obj\$(Configuration)\ + Debug + + + bin\$(Configuration)\ + obj\$(Configuration)\ + + + Debug + bin\$(Platform)\$(Configuration)\ + obj\$(Platform)\$(Configuration)\ + + + bin\$(Platform)\$(Configuration)\ + obj\$(Platform)\$(Configuration)\ + + + HarvestPath=.\SourceDir + + + + + + + + $(WixExtDir)\WixUIExtension.dll + WixUIExtension + + + + + + + + + + + + + From ebc78e59c42ba0eab7515349338dad5cc4fa288b Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 2 Nov 2020 08:53:55 -0500 Subject: [PATCH 039/114] Wrap line correctly. --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 02606c48fd..fb8a7435dd 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -187,7 +187,7 @@ steps: obj/x64/Release/Product.wixobj ` obj\x64\Release\fragment.wixobj ` -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` - -loc mlpack-localization.wxl + -loc mlpack-localization.wxl ` -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" displayName: 'Build MSI Windows installer' From 12f247fb617f6c0f6b71a79a7e4360342d43860a Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 4 Nov 2020 17:29:25 -0500 Subject: [PATCH 040/114] Try referencing the .wixproj file. --- .ci/windows-steps.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index fb8a7435dd..c6359297be 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -176,14 +176,21 @@ steps: dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + -dProjectFileName=mlpack-win-installer.wixproj ` + -dProjectName=mlpack-win-installer ` + -dProjectPath=mlpack-win-installer.wixproj ` -out obj/x64/Release/Product.wixobj ` Product.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + -dProjectFileName=mlpack-win-installer.wixproj ` + -dProjectName=mlpack-win-installer ` + -dProjectPath=mlpack-win-installer.wixproj ` -out obj/x64/Release/fragment.wixobj ` fragment.wxs dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` -b SourceDir ` + mlpack-win-installer.wixproj ` obj/x64/Release/Product.wixobj ` obj\x64\Release\fragment.wixobj ` -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` From 11e8e46e8b5494ba3aea6376dbbd8bb8fe994b70 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 6 Nov 2020 18:00:59 -0500 Subject: [PATCH 041/114] Try adding all the old options. --- .ci/windows-steps.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index c6359297be..104002c79a 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -169,6 +169,7 @@ steps: -cg DynamicFragment ` -ke ` -srd ` + -sreg ` -sfrag ` -nologo ` -out fragment.wxs @@ -176,15 +177,35 @@ steps: dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + -dConfiguration=Release ` + -dOutDir=bin\x64\Release\ ` + -dPlatform=x64 ` + -dProjectDir=. ` + -dProjectExt=.wixproj ` -dProjectFileName=mlpack-win-installer.wixproj ` -dProjectName=mlpack-win-installer ` -dProjectPath=mlpack-win-installer.wixproj ` + -dTargetDir=.\bin\x64\Release\ ` + -dTargetExt=.msi ` + -dTargetFileName=mlpack-windows.msi ` + -dTargetName=mlpack-windows ` + -dTargetPath=.\bin\x64\Release\mlpack-windows.msi ` -out obj/x64/Release/Product.wixobj ` Product.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + -dConfiguration=Release ` + -dOutDir=bin\x64\Release\ ` + -dPlatform=x64 ` + -dProjectDir=. ` + -dProjectExt=.wixproj ` -dProjectFileName=mlpack-win-installer.wixproj ` -dProjectName=mlpack-win-installer ` -dProjectPath=mlpack-win-installer.wixproj ` + -dTargetDir=.\bin\x64\Release\ ` + -dTargetExt=.msi ` + -dTargetFileName=mlpack-windows.msi ` + -dTargetName=mlpack-windows ` + -dTargetPath=.\bin\x64\Release\mlpack-windows.msi ` -out obj/x64/Release/fragment.wixobj ` fragment.wxs dir From e1d3e4da16a4990d6eca222c44aa714ad223762f Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 7 Nov 2020 10:52:57 -0500 Subject: [PATCH 042/114] Maybe HarvestPath helps? --- .ci/windows-steps.yaml | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 104002c79a..8767a2be71 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -177,6 +177,7 @@ steps: dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` + -dHarvestPath=.\Source ` -dConfiguration=Release ` -dOutDir=bin\x64\Release\ ` -dPlatform=x64 ` @@ -190,24 +191,10 @@ steps: -dTargetFileName=mlpack-windows.msi ` -dTargetName=mlpack-windows ` -dTargetPath=.\bin\x64\Release\mlpack-windows.msi ` - -out obj/x64/Release/Product.wixobj ` - Product.wxs - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - -dConfiguration=Release ` - -dOutDir=bin\x64\Release\ ` - -dPlatform=x64 ` - -dProjectDir=. ` - -dProjectExt=.wixproj ` - -dProjectFileName=mlpack-win-installer.wixproj ` - -dProjectName=mlpack-win-installer ` - -dProjectPath=mlpack-win-installer.wixproj ` - -dTargetDir=.\bin\x64\Release\ ` - -dTargetExt=.msi ` - -dTargetFileName=mlpack-windows.msi ` - -dTargetName=mlpack-windows ` - -dTargetPath=.\bin\x64\Release\mlpack-windows.msi ` - -out obj/x64/Release/fragment.wixobj ` - fragment.wxs + -out obj/x64/Release/ ` + -arch x64 ` + -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` + Product.wxs fragment.wxs dir & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` -b SourceDir ` From 23e4bd022332ff9bf7d80179b6d9eb7dd7f4a550 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 7 Nov 2020 16:29:41 -0500 Subject: [PATCH 043/114] Oops, typo in the directory name. --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 8767a2be71..47e85a6b45 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -177,7 +177,7 @@ steps: dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - -dHarvestPath=.\Source ` + -dHarvestPath=.\SourceDir ` -dConfiguration=Release ` -dOutDir=bin\x64\Release\ ` -dPlatform=x64 ` From 30bb69d9017009f7027fe37c1783d5a07be6185a Mon Sep 17 00:00:00 2001 From: RishabhGarg108 Date: Mon, 9 Nov 2020 01:13:22 +0530 Subject: [PATCH 044/114] Added copy and move constructors to linear3d layer --- src/mlpack/methods/ann/layer/linear3d.hpp | 12 ++++ .../methods/ann/layer/linear3d_impl.hpp | 56 +++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/src/mlpack/methods/ann/layer/linear3d.hpp b/src/mlpack/methods/ann/layer/linear3d.hpp index 9562074cf7..a32b694f06 100644 --- a/src/mlpack/methods/ann/layer/linear3d.hpp +++ b/src/mlpack/methods/ann/layer/linear3d.hpp @@ -54,6 +54,18 @@ class Linear3D const size_t outSize, RegularizerType regularizer = RegularizerType()); + //! Copy constructor. + Linear3D(const Linear3D& layer); + + //! Move constructor. + Linear3D(Linear3D&&); + + //! Copy assignment operator. + Linear3D& operator=(const Linear3D& layer); + + //! Move assignment operator. + Linear3D& operator=(Linear3D&& layer); + /* * Reset the layer parameter. */ diff --git a/src/mlpack/methods/ann/layer/linear3d_impl.hpp b/src/mlpack/methods/ann/layer/linear3d_impl.hpp index 97df023e37..ab7434c6c7 100644 --- a/src/mlpack/methods/ann/layer/linear3d_impl.hpp +++ b/src/mlpack/methods/ann/layer/linear3d_impl.hpp @@ -40,6 +40,62 @@ Linear3D::Linear3D( weights.set_size(outSize * inSize + outSize, 1); } +template +Linear3D::Linear3D( + const Linear3D& layer) : + inSize(layer.inSize), + outSize(layer.outSize), + weights(layer.weights), + regularizer(layer.regularizer) +{ + // Nothing to do here. +} + +template +Linear3D::Linear3D( + Linear3D&& layer) : + inSize(0), + outSize(0), + weights(std::move(layer.weights)), + regularizer(std::move(layer.regularizer)); +{ + // Nothing to do here. +} + +template +Linear3D& +Linear3D:: +operator=(const Linear3D& layer) +{ + if (this != &layer) + { + inSize = layer.inSize; + outSize = layer.outSize; + weights = layer.weights; + regularizer = layer.regularizer; + } + return *this; +} + +template +Linear3D& +Linear3D:: +operator=(Linear3D&& layer) +P + if (this != &layer) + { + inSize = 0; + outSize = 0; + weights = std::move(layer.weights); + regularizer = std::move(layer.regularizer); + } + return *this; +} + template void Linear3D::Reset() From 836b3efa9628edb71900d46dbfb7c1e24b4c9397 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 8 Nov 2020 19:36:24 -0500 Subject: [PATCH 045/114] Surely it's not that I just have to specify it as a directory? --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 47e85a6b45..fb40fe895e 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -177,7 +177,7 @@ steps: dir type fragment.wxs & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - -dHarvestPath=.\SourceDir ` + -dHarvestPath=.\SourceDir\ ` -dConfiguration=Release ` -dOutDir=bin\x64\Release\ ` -dPlatform=x64 ` From d39590accae9779d43598250442aa06071888b16 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 9 Nov 2020 09:24:20 -0500 Subject: [PATCH 046/114] Try letting MSBuild build the whole thing. --- .ci/windows-steps.yaml | 52 +++----------- .../mlpack-win-installer/Product.wxs | 70 ++++++++----------- .../mlpack-win-installer.wixproj | 21 +++--- 3 files changed, 47 insertions(+), 96 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index fb40fe895e..8d19763bb3 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -159,51 +159,15 @@ steps: { $env:INSTALL_VERSION = $env:MLPACK_VERSION; } + # Build the MSI installer. - dir - cd dist\win-installer\mlpack-win-installer - dir - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe' dir SourceDir ` - -dr INSTALLFOLDER ` - -ag ` - -cg DynamicFragment ` - -ke ` - -srd ` - -sreg ` - -sfrag ` - -nologo ` - -out fragment.wxs - dir SourceDir - dir - type fragment.wxs - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe' ` - -dHarvestPath=.\SourceDir\ ` - -dConfiguration=Release ` - -dOutDir=bin\x64\Release\ ` - -dPlatform=x64 ` - -dProjectDir=. ` - -dProjectExt=.wixproj ` - -dProjectFileName=mlpack-win-installer.wixproj ` - -dProjectName=mlpack-win-installer ` - -dProjectPath=mlpack-win-installer.wixproj ` - -dTargetDir=.\bin\x64\Release\ ` - -dTargetExt=.msi ` - -dTargetFileName=mlpack-windows.msi ` - -dTargetName=mlpack-windows ` - -dTargetPath=.\bin\x64\Release\mlpack-windows.msi ` - -out obj/x64/Release/ ` - -arch x64 ` - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" ` - Product.wxs fragment.wxs - dir - & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe' ` - -b SourceDir ` - mlpack-win-installer.wixproj ` - obj/x64/Release/Product.wixobj ` - obj\x64\Release\fragment.wixobj ` - -out ./bin/x64/Release/mlpack-%INSTALL_VERSION%.msi ` - -loc mlpack-localization.wxl ` - -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" + dir 'C:\Program Files (x86)\' + dir 'C:\Program Files (x86)\MSBuild\' + & 'C:\Program Files (x86)\MSBuild\15.0\Bin\MSBuild.exe' ` + -t:rebuild + -p:Configuration=Release ` + -p:TreatWarningsAsErrors=True ` + mlpack-win-installer.wixproj displayName: 'Build MSI Windows installer' # Publish artifacts to Azure Pipelines diff --git a/dist/win-installer/mlpack-win-installer/Product.wxs b/dist/win-installer/mlpack-win-installer/Product.wxs index 4adafc2a23..f05d12eff4 100644 --- a/dist/win-installer/mlpack-win-installer/Product.wxs +++ b/dist/win-installer/mlpack-win-installer/Product.wxs @@ -2,47 +2,39 @@ - - - + + - - - + + - - - - $(env.MLPACK_VERSION) - - - - - - + + + + + + + - - - - - - - - - - - - - - + + + + + $(env.MLPACK_VERSION) + + + + + + diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index b82fa1b8f1..16d0572fb6 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -33,27 +33,22 @@ - - - + + SourcesDir + Sources + var.SourcesDir + $(WixExtDir)\WixUIExtension.dll WixUIExtension + + + - - - - - From d964c1773793ec855f2e588401a4f1adb6ac6727 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 9 Nov 2020 17:44:20 -0500 Subject: [PATCH 047/114] Try a different path for MSBuild. --- .ci/windows-steps.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 8d19763bb3..61200a5f24 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -163,7 +163,10 @@ steps: # Build the MSI installer. dir 'C:\Program Files (x86)\' dir 'C:\Program Files (x86)\MSBuild\' - & 'C:\Program Files (x86)\MSBuild\15.0\Bin\MSBuild.exe' ` + dir 'C:\Program Files (x86)\MSBuild\15.0\' + dir 'C:\Program Files (x86)\MSBuild\15.0\Bin\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\' + & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe' ` -t:rebuild -p:Configuration=Release ` -p:TreatWarningsAsErrors=True ` From 27fc4e2eb131e02b312bc0d522c182b0d464edaf Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 10 Nov 2020 16:27:40 -0500 Subject: [PATCH 048/114] Well, evidently, that's not where MSBuild is. --- .ci/windows-steps.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 61200a5f24..59331e3b74 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -161,10 +161,6 @@ steps: } # Build the MSI installer. - dir 'C:\Program Files (x86)\' - dir 'C:\Program Files (x86)\MSBuild\' - dir 'C:\Program Files (x86)\MSBuild\15.0\' - dir 'C:\Program Files (x86)\MSBuild\15.0\Bin\' dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\' & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe' ` -t:rebuild From 081a653faf2259fef54ecc55f9ff15082a08570c Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 10 Nov 2020 19:54:39 -0500 Subject: [PATCH 049/114] This has to be the most inefficient possible way of searching for a file. --- .ci/windows-steps.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 59331e3b74..84549e1246 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -161,6 +161,16 @@ steps: } # Build the MSI installer. + dir 'C:\Program Files (x86)\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\' + dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\' dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\' & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe' ` -t:rebuild From 1bd61054f9799bbcc7959bd48e5841be57972103 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 11 Nov 2020 09:14:43 -0500 Subject: [PATCH 050/114] Got it! Now let's see if it works. --- .ci/windows-steps.yaml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 84549e1246..69d9b0d0a8 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -161,18 +161,7 @@ steps: } # Build the MSI installer. - dir 'C:\Program Files (x86)\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\' - dir 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\' - & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe' ` + & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe' ` -t:rebuild -p:Configuration=Release ` -p:TreatWarningsAsErrors=True ` From 04d23250caa2232ca79428ce9bd7791b64e38658 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 11 Nov 2020 18:19:24 -0500 Subject: [PATCH 051/114] Ugh, forgot a backtick... --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 69d9b0d0a8..5414084fa3 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -162,7 +162,7 @@ steps: # Build the MSI installer. & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe' ` - -t:rebuild + -t:rebuild ` -p:Configuration=Release ` -p:TreatWarningsAsErrors=True ` mlpack-win-installer.wixproj From 6c8123e52d01a7891e477de108c175615c0276bf Mon Sep 17 00:00:00 2001 From: RishabhGarg108 Date: Fri, 13 Nov 2020 12:09:37 +0530 Subject: [PATCH 052/114] Added test for copy and move constructor of linear3d --- src/mlpack/tests/feedforward_network_test.cpp | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index bcffa4c8a8..dd8312813e 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -155,6 +155,59 @@ TEST_CASE("CheckCopyMovingVanillaNetworkTest", "[FeedForwardNetworkTest]") CheckMoveFunction<>(model1, trainData, trainLabels, 1); } +/** + * Check whether copying and moving network with linear3d is working or not. + */ +TEST_CASE("CheckCopyMovingLinear3DNetworkTest", "[FeedForwardNetworkTest]") +{ + // Load the dataset. + arma::mat trainData; + data::Load("thyroid_train.csv", trainData, true); + + arma::mat trainLabels = trainData.row(trainData.n_rows - 1); + trainData.shed_row(trainData.n_rows - 1); + + /* + * Construct a feed forward network with trainData.n_rows input nodes, + * hiddenLayerSize hidden nodes and trainLabels.n_rows output nodes. The + * network structure looks like: + * + * Input Hidden Output + * Layer Layer Layer + * +-----+ +-----+ +-----+ + * | | | | | | + * | +------>| +------>| | + * | | +>| | +>| | + * +-----+ | +--+--+ | +-----+ + * | | + * Bias | Bias | + * Layer | Layer | + * +-----+ | +-----+ | + * | | | | | | + * | +-----+ | +-----+ + * | | | | + * +-----+ +-----+ + */ + + FFN > *model = new FFN >; + model->Add >(trainData.n_rows, 8); + model->Add >(); + model->Add >(8, 3); + model->Add >(); + + FFN > *model1 = new FFN >; + model1->Add >(trainData.n_rows, 8); + model1->Add >(); + model1->Add >(8, 3); + model1->Add >(); + + // Check whether copy constructor is working or not. + CheckCopyFunction<>(model, trainData, trainLabels, 1); + + // Check whether move constructor is working or not. + CheckMoveFunction<>(model1, trainData, trainLabels, 1); +} + /** * Train the vanilla network on a larger dataset. */ From 9a35092b8f52d7593f116c6c5480b8bcdce7acff Mon Sep 17 00:00:00 2001 From: RishabhGarg108 Date: Fri, 13 Nov 2020 15:43:23 +0530 Subject: [PATCH 053/114] Fixed typos --- src/mlpack/methods/ann/layer/linear3d_impl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/layer/linear3d_impl.hpp b/src/mlpack/methods/ann/layer/linear3d_impl.hpp index ab7434c6c7..48ae77f749 100644 --- a/src/mlpack/methods/ann/layer/linear3d_impl.hpp +++ b/src/mlpack/methods/ann/layer/linear3d_impl.hpp @@ -59,7 +59,7 @@ Linear3D::Linear3D( inSize(0), outSize(0), weights(std::move(layer.weights)), - regularizer(std::move(layer.regularizer)); + regularizer(std::move(layer.regularizer)) { // Nothing to do here. } @@ -85,7 +85,7 @@ template& Linear3D:: operator=(Linear3D&& layer) -P +{ if (this != &layer) { inSize = 0; From 541e64c3b1e77781b6e8b41579f580b9755aad23 Mon Sep 17 00:00:00 2001 From: jeffin143 Date: Fri, 13 Nov 2020 22:51:04 +0530 Subject: [PATCH 054/114] some boost cleanup --- .appveyor.yml | 1 - CMakeLists.txt | 27 +++-------------------- src/mlpack/bindings/cli/CMakeLists.txt | 1 - src/mlpack/bindings/python/CMakeLists.txt | 9 -------- src/mlpack/bindings/python/setup.py.in | 3 +-- src/mlpack/tests/CMakeLists.txt | 1 - 6 files changed, 4 insertions(+), 38 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 08c8dc4468..722a597468 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -71,7 +71,6 @@ build_script: -DARMADILLO_LIBRARY:FILEPATH=%ARMADILLO_LIBRARY% -DCEREAL_INCLUDE_DIR="C:/projects/mlpack/unofficial-flayan-cereal.1.2.2/build/native/include" -DBOOST_INCLUDEDIR:PATH=%BOOST_INCLUDE% - -DBOOST_LIBRARYDIR:PATH="C:/projects/mlpack/boost_libs" -DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF diff --git a/CMakeLists.txt b/CMakeLists.txt index 10f126283a..056edaa52e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,7 +288,6 @@ endif() # ARMADILLO_INCLUDE_DIRS - directories necessary for Armadillo includes # BOOST_ROOT - root of Boost installation # BOOST_INCLUDEDIR - include directory for Boost -# BOOST_LIBRARYDIR - library directory for Boost # ENSMALLEN_INCLUDE_DIR - include directory for ensmallen # STB_IMAGE_INCLUDE_DIR - include directory for STB image library # MATHJAX_ROOT - root of MathJax installation @@ -442,31 +441,11 @@ set(Boost_ADDITIONAL_VERSIONS # TODO for the brave: transition all mlpack's CMake to 'target-based modern # CMake'. Good luck! You'll need it. set(Boost_NO_BOOST_CMAKE 1) -find_package(Boost "${BOOST_VERSION}" - COMPONENTS - REQUIRED -) - -link_directories(${Boost_LIBRARY_DIRS}) - -# In Visual Studio, automatic linking is performed, so we don't need to worry -# about it. Clear the list of libraries to link against and let Visual Studio -# handle it. -if (MSVC) - link_directories(${Boost_LIBRARY_DIRS}) - set(CMAKE_MSVCIDE_RUN_PATH ${CMAKE_MSVCIDE_RUN_PATH} ${Boost_LIBRARY_DIRS}) - message("boost lib dirs ${Boost_LIBRARY_DIRS}") - set(Boost_LIBRARIES "") -endif () +find_package(Boost "${BOOST_VERSION}") set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) -set(MLPACK_LIBRARIES ${MLPACK_LIBRARIES} ${Boost_LIBRARIES}) -set(MLPACK_LIBRARY_DIRS ${MLPACK_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}) - -# For Boost testing framework (will have no effect on non-testing executables). -# This specifies to Boost that we are dynamically linking to the Boost test -# library. -add_definitions(-DBOOST_TEST_DYN_LINK) +set(MLPACK_LIBRARIES ${MLPACK_LIBRARIES}) +set(MLPACK_LIBRARY_DIRS ${MLPACK_LIBRARY_DIRS}) # Detect OpenMP support in a compiler. If the compiler supports OpenMP, flags # to compile with OpenMP are returned and added and the HAS_OPENMP definition diff --git a/src/mlpack/bindings/cli/CMakeLists.txt b/src/mlpack/bindings/cli/CMakeLists.txt index 1083ec41f2..4b94805fe5 100644 --- a/src/mlpack/bindings/cli/CMakeLists.txt +++ b/src/mlpack/bindings/cli/CMakeLists.txt @@ -53,7 +53,6 @@ if (BUILD_CLI_EXECUTABLES) target_link_libraries(mlpack_${name} mlpack ${ARMADILLO_LIBRARIES} - ${Boost_LIBRARIES} ${COMPILER_SUPPORT_LIBRARIES} ) # Make sure that we set BINDING_TYPE to cli so the command-line program is diff --git a/src/mlpack/bindings/python/CMakeLists.txt b/src/mlpack/bindings/python/CMakeLists.txt index 180014ed3c..65490997c3 100644 --- a/src/mlpack/bindings/python/CMakeLists.txt +++ b/src/mlpack/bindings/python/CMakeLists.txt @@ -18,7 +18,6 @@ macro (post_python_bindings) -D GENERATE_CPP_IN=${CMAKE_SOURCE_DIR}/src/mlpack/bindings/python/setup.py.in -D GENERATE_CPP_OUT=${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/setup.py -D PACKAGE_VERSION="${PACKAGE_VERSION}" - -D Boost_LIBRARY_DIRS="${Boost_LIBRARY_DIRS}" -D ARMADILLO_LIBRARIES="${ARMADILLO_LIBRARIES}" -D MLPACK_LIBRARY=$ -D MLPACK_LIBDIR=$ @@ -240,14 +239,6 @@ if (WIN32) foreach (dll ${DLL_COPY_LIBS}) file(COPY ${dll} DESTINATION ${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/mlpack/) endforeach () - - # We also need to copy the boost DLLs over. - file(GLOB boost_ser_dll_files "${Boost_LIBRARY_DIRS}/*serialization*.dll") - file(COPY ${boost_ser_dll_files} DESTINATION ${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/mlpack/) - file(GLOB boost_po_dll_files "${Boost_LIBRARY_DIRS}/*program*options*.dll") - file(COPY ${boost_po_dll_files} DESTINATION ${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/mlpack/) - file(GLOB boost_utf_dll_files "${Boost_LIBRARY_DIRS}/*unit*test*framework*.dll") - file(COPY ${boost_utf_dll_files} DESTINATION ${CMAKE_BINARY_DIR}/src/mlpack/bindings/python/mlpack/) endif () # Add a macro to build a python binding. diff --git a/src/mlpack/bindings/python/setup.py.in b/src/mlpack/bindings/python/setup.py.in index a69432f539..2d7d921a46 100644 --- a/src/mlpack/bindings/python/setup.py.in +++ b/src/mlpack/bindings/python/setup.py.in @@ -34,8 +34,7 @@ else: # directories with a (valid) space in the name will be given to us as '\ '; so, # in order to split these right, we first convert all spaces to ';', then # convert '\;' back to ' ', then split on ';'. -library_dirs = list(filter(None, ['${MLPACK_LIBDIR}'] + - '${Boost_LIBRARY_DIRS}'.replace(' ', ';').replace('\;', ' ').split(' '))) +library_dirs = list(filter(None, ['${MLPACK_LIBDIR}'])) # We'll link with the exact paths to each library using extra_objects, instead # of linking with 'libraries' and 'library_dirs', because of differences in diff --git a/src/mlpack/tests/CMakeLists.txt b/src/mlpack/tests/CMakeLists.txt index 48d05959cf..3b7ebb4b05 100644 --- a/src/mlpack/tests/CMakeLists.txt +++ b/src/mlpack/tests/CMakeLists.txt @@ -179,7 +179,6 @@ add_executable(mlpack_test target_link_libraries(mlpack_test mlpack ${ARMADILLO_LIBRARIES} - ${BOOST_LIBRARIES} ${COMPILER_SUPPORT_LIBRARIES} ) From cd1301c5d13a2a3de9b6cba823d30750efdd6471 Mon Sep 17 00:00:00 2001 From: RishabhGarg108 Date: Sat, 14 Nov 2020 10:25:07 +0530 Subject: [PATCH 055/114] Improved variable names in MSE --- .../ann/loss_functions/mean_squared_error.hpp | 18 ++++++++++-------- .../loss_functions/mean_squared_error_impl.hpp | 16 ++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp b/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp index 3c36b33611..7df7eb3cf1 100644 --- a/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp +++ b/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp @@ -42,24 +42,26 @@ class MeanSquaredError /** * Computes the mean squared error function. * - * @param input Input data used for evaluating the specified function. + * @param prediction Predictions used for evaluating the specified loss + * function. * @param target The target vector. */ - template - typename InputType::elem_type Forward(const InputType& input, + template + typename PredictionType::elem_type Forward(const PredictionType& prediction, const TargetType& target); /** * Ordinary feed backward pass of a neural network. * - * @param input The propagated input activation. + * @param prediction Predictions used for evaluating the specified loss + * function * @param target The target vector. - * @param output The calculated error. + * @param loss The calculated error. */ - template - void Backward(const InputType& input, + template + void Backward(const PredictionType& prediction, const TargetType& target, - OutputType& output); + LossType& loss); //! Get the output parameter. OutputDataType& OutputParameter() const { return outputParameter; } diff --git a/src/mlpack/methods/ann/loss_functions/mean_squared_error_impl.hpp b/src/mlpack/methods/ann/loss_functions/mean_squared_error_impl.hpp index 85cdbb3b45..ee4ae8c021 100644 --- a/src/mlpack/methods/ann/loss_functions/mean_squared_error_impl.hpp +++ b/src/mlpack/methods/ann/loss_functions/mean_squared_error_impl.hpp @@ -25,23 +25,23 @@ MeanSquaredError::MeanSquaredError() } template -template -typename InputType::elem_type +template +typename PredictionType::elem_type MeanSquaredError::Forward( - const InputType& input, + const PredictionType& prediction, const TargetType& target) { - return arma::accu(arma::square(input - target)) / target.n_cols; + return arma::accu(arma::square(prediction - target)) / target.n_cols; } template -template +template void MeanSquaredError::Backward( - const InputType& input, + const PredictionType& prediction, const TargetType& target, - OutputType& output) + LossType& loss) { - output = 2 * (input - target) / target.n_cols; + loss = 2 * (prediction - target) / target.n_cols; } template From fa26a28b583df75f94a568af0190cc4825679bc4 Mon Sep 17 00:00:00 2001 From: RishabhGarg108 Date: Sat, 14 Nov 2020 23:55:17 +0530 Subject: [PATCH 056/114] Made requested changes --- src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp b/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp index 7df7eb3cf1..0cc3f6378d 100644 --- a/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp +++ b/src/mlpack/methods/ann/loss_functions/mean_squared_error.hpp @@ -43,12 +43,12 @@ class MeanSquaredError * Computes the mean squared error function. * * @param prediction Predictions used for evaluating the specified loss - * function. + * function. * @param target The target vector. */ template typename PredictionType::elem_type Forward(const PredictionType& prediction, - const TargetType& target); + const TargetType& target); /** * Ordinary feed backward pass of a neural network. From a705ca7d3fe03f1eb483873ec230cfb4b2731c17 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 16 Nov 2020 18:32:57 -0500 Subject: [PATCH 057/114] Make sure we are in the right directory before running. --- .ci/windows-steps.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 5414084fa3..b0a383271d 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -161,6 +161,8 @@ steps: } # Build the MSI installer. + cd dist\win-installer\mlpack-win-installer + dir & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe' ` -t:rebuild ` -p:Configuration=Release ` From 93b27f6ec08df3ac7549fd1c950036951f6991bf Mon Sep 17 00:00:00 2001 From: jeffin143 Date: Tue, 17 Nov 2020 23:08:24 +0530 Subject: [PATCH 058/114] cleanup boost furthermore --- doc/guide/build.hpp | 24 ++++++++++++------------ doc/guide/build_windows.hpp | 7 ------- doc/guide/sample_ml_app.hpp | 1 - 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/doc/guide/build.hpp b/doc/guide/build.hpp index 08068eaa73..9a133319c1 100644 --- a/doc/guide/build.hpp +++ b/doc/guide/build.hpp @@ -2,10 +2,10 @@ @section build_buildintro Introduction -This document discusses how to build mlpack from source. These build directions +This document discusses how to build mlpack from source. These build directions will work for any Linux-like shell environment (for example Ubuntu, macOS, -FreeBSD etc). However, mlpack is in the repositories of many Linux distributions -and so it may be easier to use the package manager for your system. For example, +FreeBSD etc). However, mlpack is in the repositories of many Linux distributions +and so it may be easier to use the package manager for your system. For example, on Ubuntu, you can install mlpack with the following command: @code @@ -25,7 +25,7 @@ mlpack uses CMake as a build system and allows several flexible build configuration options. One can consult any of numerous CMake tutorials for further documentation, but this tutorial should be enough to get mlpack built and installed on most Linux and UNIX-like systems (including OS X). If you want -to build mlpack on Windows, see \ref build_windows (alternatively, you can read +to build mlpack on Windows, see \ref build_windows (alternatively, you can read Keon's excellent tutorial which is based on older versions). @@ -78,7 +78,7 @@ mlpack depends on the following libraries, which need to be installed on the system and have headers present: - Armadillo >= 8.400.0 (with LAPACK support) - - Boost (math_c99, unit_test_framework, heap, spirit) >= 1.58 + - Boost (math_c99, spirit) >= 1.58 - cereal >= 1.1.2 - ensmallen >= 2.10.0 (will be downloaded if not found) @@ -95,11 +95,11 @@ For Python bindings, the following packages are required: - pandas >= 0.15.0 - pytest-runner -In Ubuntu (>= 18.04) and Debian (>= 10) all of these dependencies can be +In Ubuntu (>= 18.04) and Debian (>= 10) all of these dependencies can be installed through apt: @code -# apt-get install libboost-math-dev libboost-test-dev libcereal-dev +# apt-get install libboost-math-dev libcereal-dev libarmadillo-dev binutils-dev python3-pandas python3-numpy cython3 python3-setuptools @endcode @@ -112,18 +112,18 @@ packages: # apt-get install libensmallen-dev libstb-dev @endcode -@note For older versions of Ubuntu and Debian, Armadillo needs to be built from -source as apt installs an older version. So you need to omit +@note For older versions of Ubuntu and Debian, Armadillo needs to be built from +source as apt installs an older version. So you need to omit \c libarmadillo-dev from the code snippet above and instead use this link - to download the required file. Extract this file and follow the README in the + to download the required file. Extract this file and follow the README in the uncompressed folder to build and install Armadillo. On Fedora, Red Hat, or CentOS, these same dependencies can be obtained via dnf: @code -# dnf install boost-devel boost-test boost-math armadillo-devel binutils-devel - python3-Cython python3-setuptools python3-numpy python3-pandas ensmallen-devel +# dnf install boost-devel boost-math armadillo-devel binutils-devel + python3-Cython python3-setuptools python3-numpy python3-pandas ensmallen-devel stbi-devel cereal-devel @endcode diff --git a/doc/guide/build_windows.hpp b/doc/guide/build_windows.hpp index 90fe93c0db..e150cc3b54 100644 --- a/doc/guide/build_windows.hpp +++ b/doc/guide/build_windows.hpp @@ -147,13 +147,6 @@ If you prefer to use cmake GUI, follow these instructions: following variables and reconfigure: - Name: `BOOST_INCLUDEDIR`; type `PATH`; value `C:/boost/` - Name: `BOOST_LIBRARYDIR`; type `PATH`; value `C:/boost/lib64-msvc-14.2` - - If Boost is still not found, try adding the following variables and - reconfigure: - - Name: `Boost_INCLUDE_DIR`; type `PATH`; value `C:/boost/` - - Name: `Boost_SERIALIZATION_LIBRARY_DEBUG`; type `FILEPATH`; value should be `C:/boost/lib64-msvc-14.2/boost_serialization-vc142-mt-gd-x64-1_71.lib` - - Name: `Boost_SERIALIZATION_LIBRARY_RELEASE`; type `FILEPATH`; value should be `C:/boost/lib64-msvc-14.2/boost_serialization-vc142-mt-x64-1_71.lib` - - Name: `Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG`; type `FILEPATH`; value should be `C:/boost/lib64-msvc-14.2/boost_unit_test_framework-vc142-mt-gd-x64-1_71.lib` - - Name: `Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE`; type `FILEPATH`; value should be `C:/boost/lib64-msvc-14.2/boost_unit_test_framework-vc142-mt-x64-1_71.lib` - Once CMake has configured successfully, hit "Generate" to create the `.sln` file. @section build_windows_additional_information Additional Information diff --git a/doc/guide/sample_ml_app.hpp b/doc/guide/sample_ml_app.hpp index 72a7253d5a..b8282a9ade 100644 --- a/doc/guide/sample_ml_app.hpp +++ b/doc/guide/sample_ml_app.hpp @@ -34,7 +34,6 @@ mlpack and dependencies in Release Mode). - Under Linker > Input > Additional Dependencies add: @code - C:\mlpack\mlpack-3.4.2\build\Debug\mlpack.lib - - C:\boost\boost_1_71_0\lib64-msvc-14.2\libboost_serialization-vc142-mt-gd-x64-1_71.lib @endcode - Under Build Events > Post-Build Event > Command Line add: @code From 9b30b6f8268a19091aaffd3708d4ec9c04c109f5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 17 Nov 2020 17:07:35 -0500 Subject: [PATCH 059/114] Suppress generation of registry elements. (Hopefully I read the documentation right for this part.) --- .../mlpack-win-installer/mlpack-win-installer.wixproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 16d0572fb6..087d03f6d5 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -33,7 +33,7 @@ - + SourcesDir Sources var.SourcesDir From 4f1d00ba12b1d13b8ccda7836260556d44b52eb7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 17 Nov 2020 17:08:39 -0500 Subject: [PATCH 060/114] Oh, actually, I'm pretty sure I did that wrong. --- .../mlpack-win-installer/mlpack-win-installer.wixproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 087d03f6d5..2bb01f2d69 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -33,10 +33,11 @@ - + SourcesDir Sources var.SourcesDir + true $(WixExtDir)\WixUIExtension.dll From 099bf6532a819d9fd2f0f48c1bc02d1c52774b29 Mon Sep 17 00:00:00 2001 From: jeffin sam Date: Wed, 18 Nov 2020 16:34:36 +0530 Subject: [PATCH 061/114] Update src/mlpack/bindings/python/setup.py.in Co-authored-by: Ryan Curtin --- src/mlpack/bindings/python/setup.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/bindings/python/setup.py.in b/src/mlpack/bindings/python/setup.py.in index 2d7d921a46..4762f3194b 100644 --- a/src/mlpack/bindings/python/setup.py.in +++ b/src/mlpack/bindings/python/setup.py.in @@ -34,7 +34,7 @@ else: # directories with a (valid) space in the name will be given to us as '\ '; so, # in order to split these right, we first convert all spaces to ';', then # convert '\;' back to ' ', then split on ';'. -library_dirs = list(filter(None, ['${MLPACK_LIBDIR}'])) +library_dirs = ['${MLPACK_LIBDIR}'] # We'll link with the exact paths to each library using extra_objects, instead # of linking with 'libraries' and 'library_dirs', because of differences in From f7038098653406e8cb3e2eb3c930663a1bcdee41 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 18 Nov 2020 08:38:21 -0500 Subject: [PATCH 062/114] Try to set preprocessor variable value correctly. --- .../mlpack-win-installer/mlpack-win-installer.wixproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 2bb01f2d69..6f102c34f7 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -29,7 +29,7 @@ obj\$(Platform)\$(Configuration)\ - HarvestPath=.\SourceDir + HarvestPath=.\SourceDir;SourcesDir=SourceDir From b7bc1a15896ed076a26a5764663c3360991203f3 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 19 Nov 2020 17:24:11 -0500 Subject: [PATCH 063/114] Maybe that part wasn't needed? --- dist/win-installer/mlpack-win-installer/Product.wxs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dist/win-installer/mlpack-win-installer/Product.wxs b/dist/win-installer/mlpack-win-installer/Product.wxs index f05d12eff4..f224e26ad5 100644 --- a/dist/win-installer/mlpack-win-installer/Product.wxs +++ b/dist/win-installer/mlpack-win-installer/Product.wxs @@ -25,8 +25,7 @@ - - + From fe563518d3770483b282cb86b75c65602e96b1f2 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 21 Nov 2020 11:39:07 -0500 Subject: [PATCH 064/114] Try to debug why we can't find the file. --- .ci/windows-steps.yaml | 3 +++ dist/win-installer/mlpack-win-installer/Product.wxs | 8 ++++---- .../mlpack-win-installer.wixproj | 13 ++++--------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index b0a383271d..ff8db4481c 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -163,6 +163,9 @@ steps: # Build the MSI installer. cd dist\win-installer\mlpack-win-installer dir + cd SourceDir + dir + cd .. & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe' ` -t:rebuild ` -p:Configuration=Release ` diff --git a/dist/win-installer/mlpack-win-installer/Product.wxs b/dist/win-installer/mlpack-win-installer/Product.wxs index f224e26ad5..fc2b19f544 100644 --- a/dist/win-installer/mlpack-win-installer/Product.wxs +++ b/dist/win-installer/mlpack-win-installer/Product.wxs @@ -6,11 +6,11 @@ UpgradeCode="6C2D7EC0-6F10-40CB-9703-1DC160A62662" Name="mlpack" Language="1033" - Version="$(env.MLPACK_VERSION)" + Version="$(env.MLPACK_VERSION)" Manufacturer="mlpack"> @@ -20,13 +20,13 @@ - + - + $(env.MLPACK_VERSION) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 6f102c34f7..4b35b09f08 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -9,6 +9,7 @@ mlpack-windows Package mlpack-win-installer + HarvestPath=.\SourceDir;SourceDir=SourceDir bin\$(Configuration)\ @@ -28,24 +29,18 @@ bin\$(Platform)\$(Configuration)\ obj\$(Platform)\$(Configuration)\ - - HarvestPath=.\SourceDir;SourcesDir=SourceDir - - SourcesDir - Sources - var.SourcesDir + SourceDir + SourceDir + var.SourceDir true $(WixExtDir)\WixUIExtension.dll WixUIExtension - - - From 582ee39e683237c7a0113340de94b64efe25f7d4 Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Sun, 22 Nov 2020 10:38:54 -0500 Subject: [PATCH 065/114] add copying and moving construcotr implementation --- src/mlpack/methods/ann/layer/concatenate.hpp | 14 ++++- .../methods/ann/layer/concatenate_impl.hpp | 56 +++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/concatenate.hpp b/src/mlpack/methods/ann/layer/concatenate.hpp index b27d92afee..cc50ad8514 100644 --- a/src/mlpack/methods/ann/layer/concatenate.hpp +++ b/src/mlpack/methods/ann/layer/concatenate.hpp @@ -41,6 +41,18 @@ class Concatenate */ Concatenate(); + //! Copy constructor + Concatenate(const Concatenate& layer); + + //! Move constructor + Concatenate(Concatenate&& layer); + + //! Copy operator constructor + Concatenate& operator=(const Concatenate& layer); + + //! move operator constructor + Concatenate& operator=(Concatenate&& layer); + /** * Ordinary feed forward pass of a neural network, evaluating the function * f(x) by propagating the activity forward through f. @@ -82,7 +94,7 @@ class Concatenate //! Get the concat matrix. OutputDataType const& Concat() const { return concat; } - //! Modify the delta. + //! Modify the concat. OutputDataType& Concat() { return concat; } /** diff --git a/src/mlpack/methods/ann/layer/concatenate_impl.hpp b/src/mlpack/methods/ann/layer/concatenate_impl.hpp index 20c7ba6d15..4dffc95609 100644 --- a/src/mlpack/methods/ann/layer/concatenate_impl.hpp +++ b/src/mlpack/methods/ann/layer/concatenate_impl.hpp @@ -25,6 +25,62 @@ Concatenate::Concatenate() // Nothing to do here. } +//! Copy constructor +template +Concatenate::Concatenate(const Concatenate& layer) : + inRows(layer.inRows), + weights(layer.weights), + delta(layer.delta), + concat(layer.concat) +{ + // Nothing to to here +} + +//! Move constructor +template +Concatenate::Concatenate(Concatenate&& layer) : + inRows(std::move(layer.inRows)), + weights(std::move(layer.weights)), + delta(std::move(layer.delta)), + concat(std::move(layer.concat)) +{ + // Nothing to do here +} + +template +Concatenate& +Concatenate:: +operator=(const Concatenate& layer) +{ + if (this != &layer) + { + inRows = layer.inRows; + weights = layer.weights; + delta = layer.delta; + concat = layer.concat; + } + return *this; +} + +template +Concatenate& +Concatenate:: +operator=(Concatenate&& layer) +{ + if (this != &layer) + { + inRows = std::move(layer.inRows); + layer.inRows = 0; + weights = std::move(layer.weights); + layer.weights = nullptr; + delta = std::move(layer.delta); + layer.delta = nullptr; + concat = std::move(layer.concat); + layer.concat = nullptr; + } + return *this; +} + template template void Concatenate::Forward( From fc0ac208c16fd90df995c2a0710f93605bdddc55 Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Sun, 22 Nov 2020 10:39:45 -0500 Subject: [PATCH 066/114] add test case for copying and moving constructor for Concatenate layer --- src/mlpack/tests/feedforward_network_test.cpp | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index 7188f69f50..b6b2d51e89 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -153,6 +153,56 @@ TEST_CASE("CheckCopyMovingVanillaNetworkTest", "[FeedForwardNetworkTest]") CheckMoveFunction<>(model1, trainData, trainLabels, 1); } +/** + * Concatenate layer constructor test. + */ +TEST_CASE("CheckCopyMovingConcatenateTest", "[FeedForwardNetworkTest]") +{ + // Create training input by 5x5 matrix + arma::mat input = arma::randu(10,1); + // Create training output by 1 matrix + arma::mat output = arma::mat("1"); + + // Check copying constructor + FFN> *model1 = new FFN>(); + model1->Predictors() = input; + model1->Responses() = output; + model1->Add>(); + model1->Add>(10, 5); + + // Create concatenate layer + arma::mat concatMatrix = arma::ones(5, 1); + Concatenate<>* concatLayer = new Concatenate<>(); + concatLayer->Concat() = concatMatrix; + + // Add concatenate layer to the current network + model1->Add(concatLayer); + model1->Add >(10, 5); + model1->Add>(); + + // Check whether copy constructor is working or not. + CheckCopyFunction<>(model1, input, output, 1); + + // check moving constructor + FFN> *model2 = new FFN>(); + model2->Predictors() = input; + model2->Responses() = output; + model2->Add>(); + model2->Add>(10, 5); + + // Create new concat layer + Concatenate<>* concatLayer2 = new Concatenate<>(); + concatLayer2->Concat() = concatMatrix; + + // Add concatenate layer to the current network + model2->Add(concatLayer2); + model2->Add >(10, 5); + model2->Add>(); + + // Check whether move constructor is working or not. + CheckMoveFunction<>(model2, input, output, 1); +} + /** * Train the vanilla network on a larger dataset. */ From 4312b15cde7c26a1c1d439994f1b645c4c4fe8c3 Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Sun, 22 Nov 2020 13:18:06 -0500 Subject: [PATCH 067/114] minor edit --- src/mlpack/methods/ann/layer/concatenate.hpp | 8 ++++---- .../methods/ann/layer/concatenate_impl.hpp | 6 ++---- src/mlpack/tests/feedforward_network_test.cpp | 16 ++++++++-------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/mlpack/methods/ann/layer/concatenate.hpp b/src/mlpack/methods/ann/layer/concatenate.hpp index cc50ad8514..6dbcc54d1d 100644 --- a/src/mlpack/methods/ann/layer/concatenate.hpp +++ b/src/mlpack/methods/ann/layer/concatenate.hpp @@ -41,16 +41,16 @@ class Concatenate */ Concatenate(); - //! Copy constructor + //! Copy constructor. Concatenate(const Concatenate& layer); - //! Move constructor + //! Move constructor. Concatenate(Concatenate&& layer); - //! Copy operator constructor + //! Copy operator constructor. Concatenate& operator=(const Concatenate& layer); - //! move operator constructor + //! move operator constructor. Concatenate& operator=(Concatenate&& layer); /** diff --git a/src/mlpack/methods/ann/layer/concatenate_impl.hpp b/src/mlpack/methods/ann/layer/concatenate_impl.hpp index 4dffc95609..efa642f2b9 100644 --- a/src/mlpack/methods/ann/layer/concatenate_impl.hpp +++ b/src/mlpack/methods/ann/layer/concatenate_impl.hpp @@ -25,7 +25,6 @@ Concatenate::Concatenate() // Nothing to do here. } -//! Copy constructor template Concatenate::Concatenate(const Concatenate& layer) : inRows(layer.inRows), @@ -33,10 +32,9 @@ Concatenate::Concatenate(const Concatenate& layer delta(layer.delta), concat(layer.concat) { - // Nothing to to here + // Nothing to to here. } -//! Move constructor template Concatenate::Concatenate(Concatenate&& layer) : inRows(std::move(layer.inRows)), @@ -44,7 +42,7 @@ Concatenate::Concatenate(Concatenate&& layer) : delta(std::move(layer.delta)), concat(std::move(layer.concat)) { - // Nothing to do here + // Nothing to do here. } template diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index b6b2d51e89..68672423c1 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -158,24 +158,24 @@ TEST_CASE("CheckCopyMovingVanillaNetworkTest", "[FeedForwardNetworkTest]") */ TEST_CASE("CheckCopyMovingConcatenateTest", "[FeedForwardNetworkTest]") { - // Create training input by 5x5 matrix + // Create training input by 5x5 matrix. arma::mat input = arma::randu(10,1); - // Create training output by 1 matrix + // Create training output by 1 matrix. arma::mat output = arma::mat("1"); - // Check copying constructor + // Check copying constructor. FFN> *model1 = new FFN>(); model1->Predictors() = input; model1->Responses() = output; model1->Add>(); model1->Add>(10, 5); - // Create concatenate layer + // Create concatenate layer. arma::mat concatMatrix = arma::ones(5, 1); Concatenate<>* concatLayer = new Concatenate<>(); concatLayer->Concat() = concatMatrix; - // Add concatenate layer to the current network + // Add concatenate layer to the current network. model1->Add(concatLayer); model1->Add >(10, 5); model1->Add>(); @@ -183,18 +183,18 @@ TEST_CASE("CheckCopyMovingConcatenateTest", "[FeedForwardNetworkTest]") // Check whether copy constructor is working or not. CheckCopyFunction<>(model1, input, output, 1); - // check moving constructor + // check moving constructor. FFN> *model2 = new FFN>(); model2->Predictors() = input; model2->Responses() = output; model2->Add>(); model2->Add>(10, 5); - // Create new concat layer + // Create new concat layer. Concatenate<>* concatLayer2 = new Concatenate<>(); concatLayer2->Concat() = concatMatrix; - // Add concatenate layer to the current network + // Add concatenate layer to the current network. model2->Add(concatLayer2); model2->Add >(10, 5); model2->Add>(); From 5e4d847595b1970b64b1ded88abe0adef7aba37f Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Sun, 22 Nov 2020 13:11:10 -0500 Subject: [PATCH 068/114] add copying and moving constructor --- src/mlpack/methods/ann/layer/noisylinear.hpp | 9 ++++ .../methods/ann/layer/noisylinear_impl.hpp | 42 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/mlpack/methods/ann/layer/noisylinear.hpp b/src/mlpack/methods/ann/layer/noisylinear.hpp index 34ca70193b..705b59bb75 100644 --- a/src/mlpack/methods/ann/layer/noisylinear.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear.hpp @@ -48,6 +48,15 @@ class NoisyLinear //! Copy constructor. NoisyLinear(const NoisyLinear&); + //! Move constructor + NoisyLinear(NoisyLinear&&); + + //! Operator= copy constructor + NoisyLinear& operator=(NoisyLinear const& layer); + + //! Operator= move constructor + NoisyLinear& operator=(NoisyLinear&& layer); + /* * Reset the layer parameter. */ diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index 82a3a35fc6..8bb7890bf9 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -48,6 +48,48 @@ NoisyLinear::NoisyLinear( biasEpsilon.set_size(outSize, 1); } +template +NoisyLinear::NoisyLinear( + NoisyLinear&& layer) : + inSize(std::move(layer.inSize)), + outSize(std::move(layer.outSize)), + weights(std::move(layer.weights)) +{ + layer.inSize = 0; + layer.outSize = 0; + layer.weights = nullptr; + Reset(); +} + +template +NoisyLinear& +NoisyLinear::operator=(NoisyLinear const& layer) +{ + if(this != &layer) { + inSize = layer.inSize; + outSize = layer.outSize; + weights = layer.weights; + Reset(); + } + return *this; +} + +template +NoisyLinear& +NoisyLinear::operator=(NoisyLinear&& layer) +{ + if(this != &layer) { + inSize = std::move(layer.inSize); + layer.inSize = 0; + outSize = std::move(layer.outSize); + layer.outSize = 0; + weights = std::move(layer.weights); + layer.weights = nullptr; + Reset(); + } + return *this; +} + template void NoisyLinear::Reset() { From f151fccce7252410e486bb5cf83a58385e1ad2ba Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Sun, 22 Nov 2020 13:11:34 -0500 Subject: [PATCH 069/114] add test for copy and move constructor of noisy linear layer --- src/mlpack/tests/feedforward_network_test.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index 7188f69f50..d828bb4075 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -153,6 +153,41 @@ TEST_CASE("CheckCopyMovingVanillaNetworkTest", "[FeedForwardNetworkTest]") CheckMoveFunction<>(model1, trainData, trainLabels, 1); } +/** + * Noisy Linear layer constructor test. + */ +TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") +{ + // Create training input by 5x5 matrix + arma::mat input = arma::randu(10,1); + // Create training output by 1 matrix + arma::mat output = arma::mat("1"); + + // Check copying constructor + FFN> *model1 = new FFN>(); + model1->Predictors() = input; + model1->Responses() = output; + model1->Add>(); + model1->Add>(10, 5); + model1->Add >(5, 1); + model1->Add>(); + + // Check whether copy constructor is working or not. + CheckCopyFunction<>(model1, input, output, 1); + + // Check moving constructor + FFN> *model2 = new FFN>(); + model2->Predictors() = input; + model2->Responses() = output; + model2->Add>(); + model2->Add>(10, 5); + model2->Add >(5, 1); + model2->Add>(); + + // Check whether move constructor is working or not. + CheckMoveFunction<>(model2, input, output, 1); +} + /** * Train the vanilla network on a larger dataset. */ From 1cae18a9de15ebac2eb2d7867e9a51ebd9d18618 Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Sun, 22 Nov 2020 14:03:45 -0500 Subject: [PATCH 070/114] minor edit --- src/mlpack/methods/ann/layer/noisylinear.hpp | 6 +++--- src/mlpack/tests/feedforward_network_test.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear.hpp b/src/mlpack/methods/ann/layer/noisylinear.hpp index 705b59bb75..625f7d6c6c 100644 --- a/src/mlpack/methods/ann/layer/noisylinear.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear.hpp @@ -48,13 +48,13 @@ class NoisyLinear //! Copy constructor. NoisyLinear(const NoisyLinear&); - //! Move constructor + //! Move constructor. NoisyLinear(NoisyLinear&&); - //! Operator= copy constructor + //! Operator= copy constructor. NoisyLinear& operator=(NoisyLinear const& layer); - //! Operator= move constructor + //! Operator= move constructor. NoisyLinear& operator=(NoisyLinear&& layer); /* diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index d828bb4075..9d6ff13f6a 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -158,12 +158,12 @@ TEST_CASE("CheckCopyMovingVanillaNetworkTest", "[FeedForwardNetworkTest]") */ TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") { - // Create training input by 5x5 matrix + // Create training input by 5x5 matrix. arma::mat input = arma::randu(10,1); - // Create training output by 1 matrix + // Create training output by 1 matrix. arma::mat output = arma::mat("1"); - // Check copying constructor + // Check copying constructor. FFN> *model1 = new FFN>(); model1->Predictors() = input; model1->Responses() = output; @@ -175,7 +175,7 @@ TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") // Check whether copy constructor is working or not. CheckCopyFunction<>(model1, input, output, 1); - // Check moving constructor + // Check moving constructor. FFN> *model2 = new FFN>(); model2->Predictors() = input; model2->Responses() = output; From 47a5c0b4597180f836db9a5d127035a9fc4aa07d Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Sun, 22 Nov 2020 16:47:32 -0500 Subject: [PATCH 071/114] Update src/mlpack/methods/ann/layer/noisylinear_impl.hpp Minor edit to match coding style Co-authored-by: Marcus Edel --- src/mlpack/methods/ann/layer/noisylinear_impl.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index 8bb7890bf9..b7bc47d1f5 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -65,7 +65,8 @@ template NoisyLinear& NoisyLinear::operator=(NoisyLinear const& layer) { - if(this != &layer) { + if( this != &layer) + { inSize = layer.inSize; outSize = layer.outSize; weights = layer.weights; From ab261aee7e89d872bbb50c74b78558bd94ef9583 Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Sun, 22 Nov 2020 16:47:54 -0500 Subject: [PATCH 072/114] Update src/mlpack/methods/ann/layer/noisylinear_impl.hpp Minor edit to match coding style Co-authored-by: Marcus Edel --- src/mlpack/methods/ann/layer/noisylinear_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index b7bc47d1f5..cf0af4a06f 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -50,7 +50,7 @@ NoisyLinear::NoisyLinear( template NoisyLinear::NoisyLinear( - NoisyLinear&& layer) : + NoisyLinear&& layer) : inSize(std::move(layer.inSize)), outSize(std::move(layer.outSize)), weights(std::move(layer.weights)) From 9095dd47804881f3b4e8dc7b2a3599edff4b3122 Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Sun, 22 Nov 2020 16:48:09 -0500 Subject: [PATCH 073/114] Update src/mlpack/methods/ann/layer/noisylinear_impl.hpp Minor edit to match coding style Co-authored-by: Marcus Edel --- src/mlpack/methods/ann/layer/noisylinear_impl.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index cf0af4a06f..04841a9315 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -79,7 +79,8 @@ template NoisyLinear& NoisyLinear::operator=(NoisyLinear&& layer) { - if(this != &layer) { + if (this != &layer) + { inSize = std::move(layer.inSize); layer.inSize = 0; outSize = std::move(layer.outSize); From 0471e3bc728c8665ba8a0770c2ce279dc61ba1b2 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 22 Nov 2020 20:54:37 -0500 Subject: [PATCH 074/114] Maybe some extra options here might tell us more. --- .../mlpack-win-installer/mlpack-win-installer.wixproj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 4b35b09f08..552999ed6a 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -9,21 +9,24 @@ mlpack-windows Package mlpack-win-installer + false HarvestPath=.\SourceDir;SourceDir=SourceDir + $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets + true bin\$(Configuration)\ obj\$(Configuration)\ - Debug + Debug;$(DefineConstants) bin\$(Configuration)\ obj\$(Configuration)\ - Debug bin\$(Platform)\$(Configuration)\ obj\$(Platform)\$(Configuration)\ + Debug;$(DefineConstants) bin\$(Platform)\$(Configuration)\ From 895543b2588e8ca40ca7c0ca123cae3e571a156d Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 23 Nov 2020 09:54:45 -0500 Subject: [PATCH 075/114] I have no idea if this will make a difference. --- .../mlpack-win-installer/mlpack-win-installer.wixproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 552999ed6a..3c652f4ce5 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -10,7 +10,7 @@ Package mlpack-win-installer false - HarvestPath=.\SourceDir;SourceDir=SourceDir + SourceDir=SourceDir $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets true From 0cb0a79b2dcf633e023e755732248df4118cc441 Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Mon, 23 Nov 2020 20:23:20 -0500 Subject: [PATCH 076/114] Update src/mlpack/methods/ann/layer/noisylinear.hpp Co-authored-by: Ryan Curtin --- src/mlpack/methods/ann/layer/noisylinear.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear.hpp b/src/mlpack/methods/ann/layer/noisylinear.hpp index 625f7d6c6c..f3050c9add 100644 --- a/src/mlpack/methods/ann/layer/noisylinear.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear.hpp @@ -52,7 +52,7 @@ class NoisyLinear NoisyLinear(NoisyLinear&&); //! Operator= copy constructor. - NoisyLinear& operator=(NoisyLinear const& layer); + NoisyLinear& operator=(const NoisyLinear& layer); //! Operator= move constructor. NoisyLinear& operator=(NoisyLinear&& layer); From 133dc670145c0b4cd88f69769df17ec837843462 Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Mon, 23 Nov 2020 20:23:34 -0500 Subject: [PATCH 077/114] Update src/mlpack/methods/ann/layer/noisylinear_impl.hpp Co-authored-by: Ryan Curtin --- src/mlpack/methods/ann/layer/noisylinear_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index 04841a9315..0689d46de9 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -65,7 +65,7 @@ template NoisyLinear& NoisyLinear::operator=(NoisyLinear const& layer) { - if( this != &layer) + if (this != &layer) { inSize = layer.inSize; outSize = layer.outSize; From 30589d9325c05fa50a990b63743567a774945d86 Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Mon, 23 Nov 2020 20:23:41 -0500 Subject: [PATCH 078/114] Update src/mlpack/methods/ann/layer/noisylinear_impl.hpp Co-authored-by: Ryan Curtin --- src/mlpack/methods/ann/layer/noisylinear_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index 0689d46de9..f1ae97ffd6 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -63,7 +63,7 @@ NoisyLinear::NoisyLinear( template NoisyLinear& -NoisyLinear::operator=(NoisyLinear const& layer) +NoisyLinear::operator=(const NoisyLinear& layer) { if (this != &layer) { From 835b4945dfc631c54ffa18afcd80da4811c7dc9f Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Tue, 24 Nov 2020 00:01:44 -0500 Subject: [PATCH 079/114] remove unreasonable set to nullptr and other unnecessaries --- src/mlpack/methods/ann/layer/noisylinear_impl.hpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index f1ae97ffd6..62e6a8c84c 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -51,13 +51,10 @@ NoisyLinear::NoisyLinear( template NoisyLinear::NoisyLinear( NoisyLinear&& layer) : - inSize(std::move(layer.inSize)), - outSize(std::move(layer.outSize)), + inSize(layer.inSize), + outSize(layer.outSize), weights(std::move(layer.weights)) { - layer.inSize = 0; - layer.outSize = 0; - layer.weights = nullptr; Reset(); } @@ -81,12 +78,9 @@ NoisyLinear::operator=(NoisyLinear&& layer) { if (this != &layer) { - inSize = std::move(layer.inSize); - layer.inSize = 0; - outSize = std::move(layer.outSize); - layer.outSize = 0; + inSize = layer.inSize; + outSize = layer.outSize; weights = std::move(layer.weights); - layer.weights = nullptr; Reset(); } return *this; From 16b70bdbccd44d76a2fee5c5dbf108bcd3117906 Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Tue, 24 Nov 2020 00:09:14 -0500 Subject: [PATCH 080/114] change style and correct nullptr wrongly set. --- src/mlpack/methods/ann/layer/concatenate.hpp | 4 ++-- src/mlpack/methods/ann/layer/concatenate_impl.hpp | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mlpack/methods/ann/layer/concatenate.hpp b/src/mlpack/methods/ann/layer/concatenate.hpp index 6dbcc54d1d..561ecf2595 100644 --- a/src/mlpack/methods/ann/layer/concatenate.hpp +++ b/src/mlpack/methods/ann/layer/concatenate.hpp @@ -47,10 +47,10 @@ class Concatenate //! Move constructor. Concatenate(Concatenate&& layer); - //! Copy operator constructor. + //! Operator= copy constructor. Concatenate& operator=(const Concatenate& layer); - //! move operator constructor. + //! Operator= move constructor. Concatenate& operator=(Concatenate&& layer); /** diff --git a/src/mlpack/methods/ann/layer/concatenate_impl.hpp b/src/mlpack/methods/ann/layer/concatenate_impl.hpp index efa642f2b9..10a6015de1 100644 --- a/src/mlpack/methods/ann/layer/concatenate_impl.hpp +++ b/src/mlpack/methods/ann/layer/concatenate_impl.hpp @@ -37,7 +37,7 @@ Concatenate::Concatenate(const Concatenate& layer template Concatenate::Concatenate(Concatenate&& layer) : - inRows(std::move(layer.inRows)), + inRows(layer.inRows), weights(std::move(layer.weights)), delta(std::move(layer.delta)), concat(std::move(layer.concat)) @@ -67,14 +67,10 @@ operator=(Concatenate&& layer) { if (this != &layer) { - inRows = std::move(layer.inRows); - layer.inRows = 0; + inRows = layer.inRows; weights = std::move(layer.weights); - layer.weights = nullptr; delta = std::move(layer.delta); - layer.delta = nullptr; concat = std::move(layer.concat); - layer.concat = nullptr; } return *this; } From 77d84636caa13c3281fdf077c087695aad3ac414 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 24 Nov 2020 18:49:56 -0500 Subject: [PATCH 081/114] What if we use a relative path? --- .../mlpack-win-installer/mlpack-win-installer.wixproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index 3c652f4ce5..e87b37c56f 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -10,7 +10,7 @@ Package mlpack-win-installer false - SourceDir=SourceDir + SourceDir=.\SourceDir $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets true @@ -34,7 +34,7 @@ - + SourceDir SourceDir var.SourceDir From 4cb44be9c97e5c550e43392da6709f9925c97819 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 25 Nov 2020 09:43:30 -0500 Subject: [PATCH 082/114] Is "SourceDir" somehow a word that I'm not supposed to use? --- .ci/windows-steps.yaml | 24 +++++++++---------- .../mlpack-win-installer/Product.wxs | 4 ++-- .../mlpack-win-installer.wixproj | 8 +++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index ff8db4481c..20a402ad30 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -130,20 +130,20 @@ steps: } try { (Add-Type -AssemblyName System.IO.Compression.FileSystem); - [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\mlpack-win-installer\SourceDir\doc') + [System.IO.Compression.ZipFile]::ExtractToDirectory('dist\win-installer\jenkinsdoc.zip', 'dist\win-installer\mlpack-win-installer\Sources\doc') } catch{Write-Output "Unable to add doc to installer, skipping!"} # Preparing installer staging. - mkdir dist\win-installer\mlpack-win-installer\SourceDir\lib - cp build\Release\*.lib dist\win-installer\mlpack-win-installer\SourceDir\lib\ - cp build\Release\*.exp dist\win-installer\mlpack-win-installer\SourceDir\lib\ - cp build\Release\*.dll dist\win-installer\mlpack-win-installer\SourceDir\ - cp build\Release\*.exe dist\win-installer\mlpack-win-installer\SourceDir\ - cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\mlpack-win-installer\SourceDir\ - cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\mlpack-win-installer\SourceDir\ - cp build\include\mlpack dist\win-installer\mlpack-win-installer\SourceDir -recurse - cp doc\examples dist\win-installer\mlpack-win-installer\SourceDir -recurse - cp src\mlpack\tests\data\german.csv dist\win-installer\mlpack-win-installer\SourceDir\examples\sample-ml-app\sample-ml-app\data\ + mkdir dist\win-installer\mlpack-win-installer\Sources\lib + cp build\Release\*.lib dist\win-installer\mlpack-win-installer\Sources\lib\ + cp build\Release\*.exp dist\win-installer\mlpack-win-installer\Sources\lib\ + cp build\Release\*.dll dist\win-installer\mlpack-win-installer\Sources\ + cp build\Release\*.exe dist\win-installer\mlpack-win-installer\Sources\ + cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\mlpack-win-installer\Sources\ + cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\mlpack-win-installer\Sources\ + cp build\include\mlpack dist\win-installer\mlpack-win-installer\Sources -recurse + cp doc\examples dist\win-installer\mlpack-win-installer\Sources -recurse + cp src\mlpack\tests\data\german.csv dist\win-installer\mlpack-win-installer\Sources\examples\sample-ml-app\sample-ml-app\data\ # Check current git version or mlpack version. $ver = (Get-Content "src\mlpack\core\util\version.hpp" | where {$_ -like "*MLPACK_VERSION*"}); $env:MLPACK_VERSION += $ver[0].substring($ver[0].length - 1, 1) + '.'; @@ -163,7 +163,7 @@ steps: # Build the MSI installer. cd dist\win-installer\mlpack-win-installer dir - cd SourceDir + cd Sources dir cd .. & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe' ` diff --git a/dist/win-installer/mlpack-win-installer/Product.wxs b/dist/win-installer/mlpack-win-installer/Product.wxs index fc2b19f544..4341139f71 100644 --- a/dist/win-installer/mlpack-win-installer/Product.wxs +++ b/dist/win-installer/mlpack-win-installer/Product.wxs @@ -20,13 +20,13 @@ - + - + $(env.MLPACK_VERSION) diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index e87b37c56f..b4166cedd1 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -10,7 +10,7 @@ Package mlpack-win-installer false - SourceDir=.\SourceDir + SourceDir=.\Sources $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets true @@ -34,9 +34,9 @@ - - SourceDir - SourceDir + + Sources + Sources var.SourceDir true From dcd64e669fb43f6c617b778fc283c60e0c4f5366 Mon Sep 17 00:00:00 2001 From: RishabhGarg108 Date: Wed, 25 Nov 2020 23:33:05 +0530 Subject: [PATCH 083/114] Added name to copyright --- COPYRIGHT.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 8e4088dceb..4365856baf 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -136,6 +136,7 @@ Copyright: Copyright 2020, Aakash Kaushik Copyright 2020, Anush Kini Copyright 2020, Nippun Sharma + Copyright 2020, Rishabh Garg License: BSD-3-clause All rights reserved. From b3444b28d4a448bfe63c4560a4c4e2ae0cbd5d04 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Wed, 25 Nov 2020 23:13:03 +0100 Subject: [PATCH 084/114] Remove strange characters situated at the end of each line I can not see what are these chars, but they are detect by kakoune and represented by a strange question mark. So I am removing them. Signed-off-by: Omar Shrit --- src/mlpack/core/data/load_image_impl.hpp | 190 +++++++++++------------ 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/src/mlpack/core/data/load_image_impl.hpp b/src/mlpack/core/data/load_image_impl.hpp index 8cd9b9a2ef..9a757838b9 100644 --- a/src/mlpack/core/data/load_image_impl.hpp +++ b/src/mlpack/core/data/load_image_impl.hpp @@ -1,96 +1,96 @@ -/** +/** * @file core/data/load_image_impl.hpp - * @author Mehul Kumar Nirala - * - * An image loading utility implementation. - * - * mlpack is free software; you may redistribute it and/or modify it under the - * terms of the 3-clause BSD license. You should have received a copy of the - * 3-clause BSD license along with mlpack. If not, see - * http://www.opensource.org/licenses/BSD-3-Clause for more information. - */ - -#ifndef MLPACK_CORE_DATA_LOAD_IMAGE_IMPL_HPP -#define MLPACK_CORE_DATA_LOAD_IMAGE_IMPL_HPP - -// In case it hasn't been included yet. -#include "load.hpp" - -namespace mlpack { -namespace data { - -// Image loading API. -template -bool Load(const std::string& filename, - arma::Mat& matrix, - ImageInfo& info, - const bool fatal) -{ - Timer::Start("loading_image"); - - // STB loads into unsigned char matrices, so we may have to convert once - // loaded. - arma::Mat tempMatrix; - const bool result = LoadImage(filename, tempMatrix, info, fatal); - - // If fatal is true, then the program will have already thrown an exception. - if (!result) - { - Timer::Stop("loading_image"); - return false; - } - - matrix = arma::conv_to>::from(tempMatrix); - Timer::Stop("loading_image"); - return true; -} - -// Image loading API for multiple files. -template -bool Load(const std::vector& files, - arma::Mat& matrix, - ImageInfo& info, - const bool fatal) -{ - if (files.size() == 0) - { - std::ostringstream oss; - oss << "Load(): vector of image files is empty." << std::endl; - - if (fatal) - Log::Fatal << oss.str(); - else - Log::Warn << oss.str(); - - return false; - } - - arma::Mat img; - bool status = LoadImage(files[0], img, info, fatal); - - if (!status) - return false; - - // Decide matrix dimension using the image height and width. - arma::Mat tmpMatrix( - info.Width() * info.Height() * info.Channels(), files.size()); - tmpMatrix.col(0) = img; - - for (size_t i = 1; i < files.size() ; ++i) - { - arma::Mat colImg(tmpMatrix.colptr(i), tmpMatrix.n_rows, 1, - false, true); - status = LoadImage(files[i], colImg, info, fatal); - - if (!status) - return false; - } - - matrix = arma::conv_to>::from(tmpMatrix); - return true; -} - -} // namespace data -} // namespace mlpack - -#endif + * @author Mehul Kumar Nirala + * + * An image loading utility implementation. + * + * mlpack is free software; you may redistribute it and/or modify it under the + * terms of the 3-clause BSD license. You should have received a copy of the + * 3-clause BSD license along with mlpack. If not, see + * http://www.opensource.org/licenses/BSD-3-Clause for more information. + */ + +#ifndef MLPACK_CORE_DATA_LOAD_IMAGE_IMPL_HPP +#define MLPACK_CORE_DATA_LOAD_IMAGE_IMPL_HPP + +// In case it hasn't been included yet. +#include "load.hpp" + +namespace mlpack { +namespace data { + +// Image loading API. +template +bool Load(const std::string& filename, + arma::Mat& matrix, + ImageInfo& info, + const bool fatal) +{ + Timer::Start("loading_image"); + + // STB loads into unsigned char matrices, so we may have to convert once + // loaded. + arma::Mat tempMatrix; + const bool result = LoadImage(filename, tempMatrix, info, fatal); + + // If fatal is true, then the program will have already thrown an exception. + if (!result) + { + Timer::Stop("loading_image"); + return false; + } + + matrix = arma::conv_to>::from(tempMatrix); + Timer::Stop("loading_image"); + return true; +} + +// Image loading API for multiple files. +template +bool Load(const std::vector& files, + arma::Mat& matrix, + ImageInfo& info, + const bool fatal) +{ + if (files.size() == 0) + { + std::ostringstream oss; + oss << "Load(): vector of image files is empty." << std::endl; + + if (fatal) + Log::Fatal << oss.str(); + else + Log::Warn << oss.str(); + + return false; + } + + arma::Mat img; + bool status = LoadImage(files[0], img, info, fatal); + + if (!status) + return false; + + // Decide matrix dimension using the image height and width. + arma::Mat tmpMatrix( + info.Width() * info.Height() * info.Channels(), files.size()); + tmpMatrix.col(0) = img; + + for (size_t i = 1; i < files.size() ; ++i) + { + arma::Mat colImg(tmpMatrix.colptr(i), tmpMatrix.n_rows, 1, + false, true); + status = LoadImage(files[i], colImg, info, fatal); + + if (!status) + return false; + } + + matrix = arma::conv_to>::from(tmpMatrix); + return true; +} + +} // namespace data +} // namespace mlpack + +#endif From cb4303a37e8a07d63a0faca1ef0cdf2e95693fcd Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 25 Nov 2020 17:40:55 -0500 Subject: [PATCH 085/114] Wait. It worked??? --- .ci/windows-steps.yaml | 2 +- .../mlpack-win-installer/mlpack-win-installer.wixproj | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 20a402ad30..4a4461d1fa 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -191,7 +191,7 @@ steps: displayName: 'Publish artifacts test results' - task: PublishBuildArtifacts@1 inputs: - pathtoPublish: 'dist\win-installer\mlpack-win-installer\bin\x64\Release\*.msi' + pathtoPublish: 'dist\win-installer\mlpack-win-installer\bin\Release\*.msi' artifactName: mlpack-windows-installer displayName: 'Publish Windows MSI installer' diff --git a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj index b4166cedd1..0e89ee825c 100644 --- a/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj +++ b/dist/win-installer/mlpack-win-installer/mlpack-win-installer.wixproj @@ -12,7 +12,6 @@ false SourceDir=.\Sources $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets - true bin\$(Configuration)\ From 16aeaa1f764e892094ebd3c869c0f740ac5058ca Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Wed, 25 Nov 2020 20:57:05 -0500 Subject: [PATCH 086/114] Revert "remove unreasonable set to nullptr and other unnecessaries" This reverts commit 835b4945dfc631c54ffa18afcd80da4811c7dc9f. --- src/mlpack/methods/ann/layer/noisylinear_impl.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp index 62e6a8c84c..f1ae97ffd6 100644 --- a/src/mlpack/methods/ann/layer/noisylinear_impl.hpp +++ b/src/mlpack/methods/ann/layer/noisylinear_impl.hpp @@ -51,10 +51,13 @@ NoisyLinear::NoisyLinear( template NoisyLinear::NoisyLinear( NoisyLinear&& layer) : - inSize(layer.inSize), - outSize(layer.outSize), + inSize(std::move(layer.inSize)), + outSize(std::move(layer.outSize)), weights(std::move(layer.weights)) { + layer.inSize = 0; + layer.outSize = 0; + layer.weights = nullptr; Reset(); } @@ -78,9 +81,12 @@ NoisyLinear::operator=(NoisyLinear&& layer) { if (this != &layer) { - inSize = layer.inSize; - outSize = layer.outSize; + inSize = std::move(layer.inSize); + layer.inSize = 0; + outSize = std::move(layer.outSize); + layer.outSize = 0; weights = std::move(layer.weights); + layer.weights = nullptr; Reset(); } return *this; From 26f94f265269eaa9d7a88d96a0b4ddd0e20511ea Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Wed, 25 Nov 2020 20:59:03 -0500 Subject: [PATCH 087/114] fix comment --- src/mlpack/tests/feedforward_network_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index c5b1b874d8..57af43ff39 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -186,8 +186,8 @@ TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") // Check whether move constructor is working or not. CheckMoveFunction<>(model2, input, output, 1); - * Check whether copying and moving network with dropout is working or not. - */ +} + TEST_CASE("CheckCopyMovingDropoutNetworkTest", "[FeedForwardNetworkTest]") { // Load the dataset. From 51b5719f7ab0fa125cebd1cc0e5dcbca88202846 Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Wed, 25 Nov 2020 21:09:20 -0500 Subject: [PATCH 088/114] more comment fix --- src/mlpack/tests/feedforward_network_test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index 57af43ff39..774bb53f18 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -154,7 +154,7 @@ TEST_CASE("CheckCopyMovingVanillaNetworkTest", "[FeedForwardNetworkTest]") } /** - * Noisy Linear layer constructor test. + * Check whether copying and moving of Noisy Linear layer is working or not. */ TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") { @@ -188,6 +188,9 @@ TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") CheckMoveFunction<>(model2, input, output, 1); } +/** + * Check whether copying and moving of Dropout network is working or not. + */ TEST_CASE("CheckCopyMovingDropoutNetworkTest", "[FeedForwardNetworkTest]") { // Load the dataset. From f700776ddbbe3c51e3ec9f0b2c08748059510358 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 25 Nov 2020 23:03:51 -0500 Subject: [PATCH 089/114] Maybe a wildcard doesn't work here. --- .ci/windows-steps.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 4a4461d1fa..1356125809 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -191,7 +191,7 @@ steps: displayName: 'Publish artifacts test results' - task: PublishBuildArtifacts@1 inputs: - pathtoPublish: 'dist\win-installer\mlpack-win-installer\bin\Release\*.msi' + pathtoPublish: 'dist\win-installer\mlpack-win-installer\bin\Release\mlpack-windows.msi' artifactName: mlpack-windows-installer displayName: 'Publish Windows MSI installer' From 4028ef8de1596251a02427b46a968b8f23cacdea Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Thu, 26 Nov 2020 11:19:39 +0100 Subject: [PATCH 090/114] Remove Windows ending from this file too Signed-off-by: Omar Shrit --- src/mlpack/core/data/image_info_impl.hpp | 152 +++++++++++------------ 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/src/mlpack/core/data/image_info_impl.hpp b/src/mlpack/core/data/image_info_impl.hpp index b0257c5d89..3040a38415 100644 --- a/src/mlpack/core/data/image_info_impl.hpp +++ b/src/mlpack/core/data/image_info_impl.hpp @@ -1,77 +1,77 @@ -/** +/** * @file core/data/image_info_impl.hpp - * @author Mehul Kumar Nirala - * - * An image information holder implementation. - * - * mlpack is free software; you may redistribute it and/or modify it under the - * terms of the 3-clause BSD license. You should have received a copy of the - * 3-clause BSD license along with mlpack. If not, see - * http://www.opensource.org/licenses/BSD-3-Clause for more information. - */ - -#ifndef MLPACK_CORE_DATA_IMAGE_INFO_IMPL_HPP -#define MLPACK_CORE_DATA_IMAGE_INFO_IMPL_HPP - -#ifdef HAS_STB // Compile this only if stb is present. - -// In case it hasn't been included yet. -#include "image_info.hpp" - -namespace mlpack { -namespace data { - -static const std::vector loadFileTypes({"jpg", "png", "tga", - "bmp", "psd", "gif", "hdr", "pic", "pnm", "jpeg"}); - -static const std::vector saveFileTypes({"jpg", "png", "tga", - "bmp", "hdr"}); - -inline bool ImageFormatSupported(const std::string& fileName, const bool save) -{ - if (save) - { - // Iterate over all supported file types that can be saved. - for (auto extension : saveFileTypes) - { - if (extension == Extension(fileName)) - return true; - } - } - else - { - // Iterate over all supported file types that can be loaded. - for (auto extension : loadFileTypes) - { - if (extension == Extension(fileName)) - return true; - } - } - - return false; -} - -} // namespace data -} // namespace mlpack - -#endif // HAS_STB. - -namespace mlpack { -namespace data { - -inline ImageInfo::ImageInfo(const size_t width, - const size_t height, - const size_t channels, - const size_t quality) : - width(width), - height(height), - channels(channels), - quality(quality) -{ - // Do nothing. -} - -} // namespace data -} // namespace mlpack - -#endif + * @author Mehul Kumar Nirala + * + * An image information holder implementation. + * + * mlpack is free software; you may redistribute it and/or modify it under the + * terms of the 3-clause BSD license. You should have received a copy of the + * 3-clause BSD license along with mlpack. If not, see + * http://www.opensource.org/licenses/BSD-3-Clause for more information. + */ + +#ifndef MLPACK_CORE_DATA_IMAGE_INFO_IMPL_HPP +#define MLPACK_CORE_DATA_IMAGE_INFO_IMPL_HPP + +#ifdef HAS_STB // Compile this only if stb is present. + +// In case it hasn't been included yet. +#include "image_info.hpp" + +namespace mlpack { +namespace data { + +static const std::vector loadFileTypes({"jpg", "png", "tga", + "bmp", "psd", "gif", "hdr", "pic", "pnm", "jpeg"}); + +static const std::vector saveFileTypes({"jpg", "png", "tga", + "bmp", "hdr"}); + +inline bool ImageFormatSupported(const std::string& fileName, const bool save) +{ + if (save) + { + // Iterate over all supported file types that can be saved. + for (auto extension : saveFileTypes) + { + if (extension == Extension(fileName)) + return true; + } + } + else + { + // Iterate over all supported file types that can be loaded. + for (auto extension : loadFileTypes) + { + if (extension == Extension(fileName)) + return true; + } + } + + return false; +} + +} // namespace data +} // namespace mlpack + +#endif // HAS_STB. + +namespace mlpack { +namespace data { + +inline ImageInfo::ImageInfo(const size_t width, + const size_t height, + const size_t channels, + const size_t quality) : + width(width), + height(height), + channels(channels), + quality(quality) +{ + // Do nothing. +} + +} // namespace data +} // namespace mlpack + +#endif From 451c5fde743b5c9861e6180d78dcbe874977cedc Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Thu, 26 Nov 2020 11:32:00 +0100 Subject: [PATCH 091/114] Fix these dataset too from windows ending Signed-off-by: Omar Shrit --- .../tests/data/nbc_high_dim_test_labels.csv | 100 ++--- .../tests/data/nbc_high_dim_train_labels.csv | 400 +++++++++--------- 2 files changed, 250 insertions(+), 250 deletions(-) diff --git a/src/mlpack/tests/data/nbc_high_dim_test_labels.csv b/src/mlpack/tests/data/nbc_high_dim_test_labels.csv index dd6bde5f4b..59847158f6 100644 --- a/src/mlpack/tests/data/nbc_high_dim_test_labels.csv +++ b/src/mlpack/tests/data/nbc_high_dim_test_labels.csv @@ -1,50 +1,50 @@ -3 -2 -0 -0 -0 -1 -2 -3 -3 -2 -4 -2 -1 -2 -3 -1 -2 -4 -4 -1 -3 -0 -2 -0 -0 -2 -0 -1 -3 -3 -2 -2 -2 -3 -3 -3 -3 -3 -0 -0 -4 -3 -3 -0 -3 -2 -3 -2 -1 -1 +3 +2 +0 +0 +0 +1 +2 +3 +3 +2 +4 +2 +1 +2 +3 +1 +2 +4 +4 +1 +3 +0 +2 +0 +0 +2 +0 +1 +3 +3 +2 +2 +2 +3 +3 +3 +3 +3 +0 +0 +4 +3 +3 +0 +3 +2 +3 +2 +1 +1 diff --git a/src/mlpack/tests/data/nbc_high_dim_train_labels.csv b/src/mlpack/tests/data/nbc_high_dim_train_labels.csv index 064f0e24a2..c25922d7a4 100644 --- a/src/mlpack/tests/data/nbc_high_dim_train_labels.csv +++ b/src/mlpack/tests/data/nbc_high_dim_train_labels.csv @@ -1,200 +1,200 @@ -1 -4 -2 -2 -1 -0 -1 -0 -0 -4 -0 -4 -3 -4 -3 -2 -4 -2 -2 -2 -4 -1 -2 -1 -3 -0 -4 -1 -4 -4 -4 -0 -3 -4 -3 -1 -3 -2 -3 -0 -4 -1 -4 -1 -4 -2 -1 -4 -2 -1 -2 -0 -2 -2 -4 -2 -0 -2 -0 -3 -3 -3 -0 -2 -1 -4 -3 -1 -2 -2 -4 -0 -1 -3 -4 -4 -4 -2 -4 -2 -3 -4 -4 -3 -2 -3 -3 -4 -3 -4 -2 -4 -0 -3 -3 -1 -3 -4 -2 -1 -2 -3 -1 -3 -3 -0 -4 -0 -0 -3 -2 -1 -0 -3 -2 -1 -0 -0 -1 -0 -2 -2 -4 -2 -3 -1 -4 -4 -2 -3 -4 -0 -2 -2 -0 -4 -0 -3 -1 -4 -4 -2 -0 -0 -0 -0 -3 -4 -3 -2 -0 -4 -3 -3 -4 -0 -3 -1 -3 -4 -3 -2 -2 -4 -0 -0 -0 -0 -1 -4 -0 -3 -4 -3 -1 -4 -0 -1 -4 -3 -2 -1 -3 -2 -4 -3 -2 -0 -1 -4 -2 -0 -2 -3 -0 -0 -2 -1 -3 -1 +1 +4 +2 +2 +1 +0 +1 +0 +0 +4 +0 +4 +3 +4 +3 +2 +4 +2 +2 +2 +4 +1 +2 +1 +3 +0 +4 +1 +4 +4 +4 +0 +3 +4 +3 +1 +3 +2 +3 +0 +4 +1 +4 +1 +4 +2 +1 +4 +2 +1 +2 +0 +2 +2 +4 +2 +0 +2 +0 +3 +3 +3 +0 +2 +1 +4 +3 +1 +2 +2 +4 +0 +1 +3 +4 +4 +4 +2 +4 +2 +3 +4 +4 +3 +2 +3 +3 +4 +3 +4 +2 +4 +0 +3 +3 +1 +3 +4 +2 +1 +2 +3 +1 +3 +3 +0 +4 +0 +0 +3 +2 +1 +0 +3 +2 +1 +0 +0 +1 +0 +2 +2 +4 +2 +3 +1 +4 +4 +2 +3 +4 +0 +2 +2 +0 +4 +0 +3 +1 +4 +4 +2 +0 +0 +0 +0 +3 +4 +3 +2 +0 +4 +3 +3 +4 +0 +3 +1 +3 +4 +3 +2 +2 +4 +0 +0 +0 +0 +1 +4 +0 +3 +4 +3 +1 +4 +0 +1 +4 +3 +2 +1 +3 +2 +4 +3 +2 +0 +1 +4 +2 +0 +2 +3 +0 +0 +2 +1 +3 +1 From d0d56d0049afab7a67c9a664272483ad49497e75 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 26 Nov 2020 11:02:03 -0500 Subject: [PATCH 092/114] Fix apparent typo. --- dist/win-installer/mlpack-win-installer/Product.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/win-installer/mlpack-win-installer/Product.wxs b/dist/win-installer/mlpack-win-installer/Product.wxs index 4341139f71..3cd7598a85 100644 --- a/dist/win-installer/mlpack-win-installer/Product.wxs +++ b/dist/win-installer/mlpack-win-installer/Product.wxs @@ -30,7 +30,7 @@ $(env.MLPACK_VERSION) - + From 85422870f4b01f1800512cf5515a3fcfbe3983b7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 26 Nov 2020 11:02:26 -0500 Subject: [PATCH 093/114] Re-add other CI jobs. --- .ci/ci.yaml | 100 ++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/.ci/ci.yaml b/.ci/ci.yaml index fad956f7f8..26efee03ae 100644 --- a/.ci/ci.yaml +++ b/.ci/ci.yaml @@ -8,56 +8,56 @@ pr: - '*' jobs: -#- job: Linux -# timeoutInMinutes: 360 -# pool: -# vmImage: ubuntu-16.04 -# strategy: -# matrix: -# Plain: -# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' -# Python: -# binding: 'python' -# python.version: '3.7' -# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' -# Julia: -# julia.version: '1.3.0' -# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_GO_BINDINGS=OFF -DJULIA_EXECUTABLE=/opt/julia-1.3.0/bin/julia -DBUILD_R_BINDINGS=OFF' -# Go: -# binding: 'go' -# go.version: '1.11.0' -# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' -# Markdown: -# CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_MARKDOWN_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' -# -# steps: -# - template: linux-steps.yaml -# -#- job: macOS -# timeoutInMinutes: 360 -# pool: -# vmImage: macOS-latest -# strategy: -# matrix: -# Plain: -# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' -# python.version: '2.7' -# Python: -# binding: 'python' -# python.version: '3.7' -# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' -# Julia: -# python.version: '2.7' -# julia.version: '1.3.0' -# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' -# Go: -# binding: 'go' -# python.version: '2.7' -# go.version: '1.11.0' -# CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' -# -# steps: -# - template: macos-steps.yaml +- job: Linux + timeoutInMinutes: 360 + pool: + vmImage: ubuntu-16.04 + strategy: + matrix: + Plain: + CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' + Python: + binding: 'python' + python.version: '3.7' + CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' + Julia: + julia.version: '1.3.0' + CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_GO_BINDINGS=OFF -DJULIA_EXECUTABLE=/opt/julia-1.3.0/bin/julia -DBUILD_R_BINDINGS=OFF' + Go: + binding: 'go' + go.version: '1.11.0' + CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' + Markdown: + CMakeArgs: '-DDEBUG=OFF -DPROFILE=OFF -DBUILD_MARKDOWN_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' + + steps: + - template: linux-steps.yaml + +- job: macOS + timeoutInMinutes: 360 + pool: + vmImage: macOS-latest + strategy: + matrix: + Plain: + CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' + python.version: '2.7' + Python: + binding: 'python' + python.version: '3.7' + CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' + Julia: + python.version: '2.7' + julia.version: '1.3.0' + CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_JULIA_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_GO_BINDINGS=OFF -DBUILD_R_BINDINGS=OFF' + Go: + binding: 'go' + python.version: '2.7' + go.version: '1.11.0' + CMakeArgs: '-DDEBUG=ON -DPROFILE=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_JULIA_BINDINGS=OFF -DBUILD_GO_BINDINGS=ON -DBUILD_R_BINDINGS=OFF' + + steps: + - template: macos-steps.yaml - job: WindowsVS16 timeoutInMinutes: 360 From 73299a6d073ea9526c2ffa66925736181994501c Mon Sep 17 00:00:00 2001 From: shawnbrar <59639827+shawnbrar@users.noreply.github.com> Date: Fri, 27 Nov 2020 08:33:58 +0100 Subject: [PATCH 094/114] Added Copyright statement Pull Request 2624 --- COPYRIGHT.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 8e4088dceb..851f65cc0d 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -136,6 +136,7 @@ Copyright: Copyright 2020, Aakash Kaushik Copyright 2020, Anush Kini Copyright 2020, Nippun Sharma + Copyright 2020, Sudhakar Brar License: BSD-3-clause All rights reserved. From 1ae1bae7acbc0e50f0bea559b55dd9296c03a440 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 28 Nov 2020 13:44:55 -0500 Subject: [PATCH 095/114] Remove boost unit test framework entirely. --- .ci/windows-steps.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index 1356125809..ee5e9ba578 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -10,7 +10,6 @@ steps: - powershell: | nuget install OpenBLAS -o $(Agent.ToolsDirectory) nuget install boost -o $(Agent.ToolsDirectory) -Version 1.60.0 - nuget install boost_unit_test_framework-vc140 -o $(Agent.ToolsDirectory) -Version 1.60.0 nuget install boost_random-vc140 -o $(Agent.ToolsDirectory) -Version 1.60.0 nuget install boost_math_c99-vc140 -o $(Agent.ToolsDirectory) -Version 1.60.0 nuget install OpenBLAS -o $(Agent.ToolsDirectory) @@ -19,7 +18,6 @@ steps: mkdir -p $(Agent.ToolsDirectory)/boost_libs cp $(Agent.ToolsDirectory)/boost_math_c99-vc140.1.60.0.0/lib/native/address-model-64/lib/*.* $(Agent.ToolsDirectory)/boost_libs cp $(Agent.ToolsDirectory)/boost_random-vc140.1.60.0.0/lib/native/address-model-64/lib/*.* $(Agent.ToolsDirectory)/boost_libs - cp $(Agent.ToolsDirectory)/boost_unit_test_framework-vc140.1.60.0.0/lib/native/address-model-64/lib/*.* $(Agent.ToolsDirectory)/boost_libs displayName: 'Fetch build dependencies' # Configure armadillo @@ -140,7 +138,6 @@ steps: cp build\Release\*.dll dist\win-installer\mlpack-win-installer\Sources\ cp build\Release\*.exe dist\win-installer\mlpack-win-installer\Sources\ cp $(Agent.ToolsDirectory)\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll dist\win-installer\mlpack-win-installer\Sources\ - cp $(Agent.ToolsDirectory)\boost_libs\boost_unit_test_framework-vc*.dll dist\win-installer\mlpack-win-installer\Sources\ cp build\include\mlpack dist\win-installer\mlpack-win-installer\Sources -recurse cp doc\examples dist\win-installer\mlpack-win-installer\Sources -recurse cp src\mlpack\tests\data\german.csv dist\win-installer\mlpack-win-installer\Sources\examples\sample-ml-app\sample-ml-app\data\ From 0ea76f39348084e7cb7bd1a4814ef7aea5ac74c9 Mon Sep 17 00:00:00 2001 From: Nippun Sharma <53967069+NippunSharma@users.noreply.github.com> Date: Sun, 29 Nov 2020 13:22:24 +0530 Subject: [PATCH 096/114] changed from LinearLayer to Recurrent --- src/mlpack/methods/ann/layer/recurrent.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/layer/recurrent.hpp b/src/mlpack/methods/ann/layer/recurrent.hpp index 0466b265b0..88f6d97ab4 100644 --- a/src/mlpack/methods/ann/layer/recurrent.hpp +++ b/src/mlpack/methods/ann/layer/recurrent.hpp @@ -2,8 +2,7 @@ * @file methods/ann/layer/recurrent.hpp * @author Marcus Edel * - * Definition of the LinearLayer class also known as fully-connected layer or - * affine transformation. + * Definition of the Recurrent class. * * mlpack is free software; you may redistribute it and/or modify it under the * terms of the 3-clause BSD license. You should have received a copy of the From 56271d92f4a261dffc6bf39d457ff8f375e8b09b Mon Sep 17 00:00:00 2001 From: Nippun Sharma <53967069+NippunSharma@users.noreply.github.com> Date: Sun, 29 Nov 2020 13:23:30 +0530 Subject: [PATCH 097/114] changed comment from LinearLayer to Recurrent in impl --- src/mlpack/methods/ann/layer/recurrent_impl.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/layer/recurrent_impl.hpp b/src/mlpack/methods/ann/layer/recurrent_impl.hpp index 23a1dc4625..43d807dd1a 100644 --- a/src/mlpack/methods/ann/layer/recurrent_impl.hpp +++ b/src/mlpack/methods/ann/layer/recurrent_impl.hpp @@ -2,8 +2,7 @@ * @file methods/ann/layer/recurrent_impl.hpp * @author Marcus Edel * - * Implementation of the LinearLayer class also known as fully-connected layer - * or affine transformation. + * Implementation of the Recurrent class. * * mlpack is free software; you may redistribute it and/or modify it under the * terms of the 3-clause BSD license. You should have received a copy of the From 36abf95778fe4538a489b6d9ccf940b4c57c1ede Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 29 Nov 2020 12:14:37 -0500 Subject: [PATCH 098/114] Remove debugging output. --- .ci/windows-steps.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.ci/windows-steps.yaml b/.ci/windows-steps.yaml index ee5e9ba578..e2a9ed38e0 100644 --- a/.ci/windows-steps.yaml +++ b/.ci/windows-steps.yaml @@ -159,10 +159,6 @@ steps: # Build the MSI installer. cd dist\win-installer\mlpack-win-installer - dir - cd Sources - dir - cd .. & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe' ` -t:rebuild ` -p:Configuration=Release ` From 8c49ba0b3a80a15eb38a919944080450d6905b02 Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Mon, 30 Nov 2020 14:22:43 +0530 Subject: [PATCH 099/114] FastLSTM and RNN Copy and Move constructor added --- src/mlpack/methods/ann/layer/fast_lstm.hpp | 12 ++++ .../methods/ann/layer/fast_lstm_impl.hpp | 54 +++++++++++++++++ src/mlpack/methods/ann/rnn.hpp | 12 ++++ src/mlpack/methods/ann/rnn_impl.hpp | 43 ++++++++++++++ src/mlpack/tests/ann_layer_test.cpp | 59 +++++++++++++++++++ 5 files changed, 180 insertions(+) diff --git a/src/mlpack/methods/ann/layer/fast_lstm.hpp b/src/mlpack/methods/ann/layer/fast_lstm.hpp index 121c97e176..212fc8f503 100644 --- a/src/mlpack/methods/ann/layer/fast_lstm.hpp +++ b/src/mlpack/methods/ann/layer/fast_lstm.hpp @@ -73,6 +73,18 @@ class FastLSTM //! Create the Fast LSTM object. FastLSTM(); + //! Copy Constructor + FastLSTM(const FastLSTM& layer); + + //! Move Constructor + FastLSTM(FastLSTM&& layer); + + //! Copy assignment operator + FastLSTM& operator=(const FastLSTM& layer); + + //! Move assignment operator + FastLSTM& operator=(FastLSTM&& layer); + /** * Create the Fast LSTM layer object using the specified parameters. * diff --git a/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp b/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp index 5f5502cf9a..7ffe95833b 100644 --- a/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp +++ b/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp @@ -45,6 +45,60 @@ FastLSTM::FastLSTM( weights.set_size(WeightSize(), 1); } +template +FastLSTM::FastLSTM(const FastLSTM& layer) : + inSize(layer.inSize), + outSize(layer.outSize), + rho(layer.rho), + weights(layer.weights) +{ + // Nothing to do here. + std::cout << "Trying to copy fast LSTM layer" << std::endl; +} + +template +FastLSTM::FastLSTM(FastLSTM&& layer) : + inSize(std::move(layer.inSize)), + outSize(std::move(layer.outSize)), + rho(std::move(layer.rho)), + weights(std::move(layer.weights)) +{ + // Nothing to do here. + std::cout << "Trying to move fast LSTM layer" << std::endl; +} + +template +FastLSTM& +FastLSTM::operator=(const FastLSTM& layer) +{ + std::cout << "Trying to copy fast LSTM layer" << std::endl; + if (this != &layer) + { + inSize = layer.inSize; + outSize = layer.outSize; + rho = layer.rho; + weights = layer.weights; + } + std::cout << "Copied layer and returned" << std::endl; + return *this; +} + +template +FastLSTM& +FastLSTM::operator=(FastLSTM&& layer) +{ + std::cout << "Trying to move fast LSTM layer" << std::endl; + if (this != &layer) + { + inSize = std::move(layer.inSize); + outSize = std::move(layer.outSize); + rho = std::move(layer.rho); + weights = std::move(layer.weights); + } + std::cout << "Moved and returned" << std::endl; + return *this; +} + template void FastLSTM::Reset() { diff --git a/src/mlpack/methods/ann/rnn.hpp b/src/mlpack/methods/ann/rnn.hpp index e9e6815de4..0e653ea0f9 100644 --- a/src/mlpack/methods/ann/rnn.hpp +++ b/src/mlpack/methods/ann/rnn.hpp @@ -70,6 +70,15 @@ class RNN OutputLayerType outputLayer = OutputLayerType(), InitializationRuleType initializeRule = InitializationRuleType()); + //! Copy constructor. + RNN(const RNN&); + + //! Move constructor. + RNN(RNN&&); + + //! Copy/move assignment operator. + RNN& operator = (RNN); + //! Destructor to release allocated memory. ~RNN(); @@ -412,6 +421,9 @@ class RNN //! Locally-stored weight size visitor. WeightSizeVisitor weightSizeVisitor; + //! Locally-stored copy visitor + CopyVisitor copyVisitor; + //! Locally-stored reset visitor. ResetVisitor resetVisitor; diff --git a/src/mlpack/methods/ann/rnn_impl.hpp b/src/mlpack/methods/ann/rnn_impl.hpp index b81bc397b2..66bef0855b 100644 --- a/src/mlpack/methods/ann/rnn_impl.hpp +++ b/src/mlpack/methods/ann/rnn_impl.hpp @@ -49,6 +49,49 @@ RNN::RNN( /* Nothing to do here */ } +template +RNN::RNN( + const RNN& network) : + rho(network.rho), + initializeRule(network.initializeRule), + inputSize(network.inputSize), + outputLayer(network.outputLayer), + outputSize(network.outputSize), + targetSize(network.targetSize), + reset(network.reset), + single(network.single), + numFunctions(network.numFunctions), + deterministic(network.deterministic), + parameter(network.parameter) +{ + for (size_t i = 0; i < network.network.size(); ++i) + { + this->network.push_back(boost::apply_visitor(copyVisitor, + network.network[i])); + boost::apply_visitor(resetVisitor, this->network[i]); + } +} + +template +RNN::RNN( + RNN&& network) : + rho(std::move(network.rho)), + initializeRule(std::move(network.initializeRule)), + inputSize(std::move(network.inputSize)), + outputLayer(std::move(network.outputLayer)), + outputSize(std::move(network.outputSize)), + targetSize(std::move(network.targetSize)), + reset(std::move(network.reset)), + single(std::move(network.single)), + numFunctions(std::move(network.numFunctions)), + deterministic(std::move(network.deterministic)), + parameter(std::move(network.parameter)) +{ + this->network = std::move(network.network); +} + template RNN::~RNN() diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 63da44b2ee..c3f6efc70a 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -1183,6 +1183,65 @@ TEST_CASE("FastLSTMLayerParametersTest", "[ANNLayerTest]") REQUIRE(layer1.Rho() == layer2.Rho()); } +/** + * Check whether copying and moving network with FastLSTM is working or not. + */ + TEST_CASE("CheckCopyFastLSTMTest", "[ANNLayerTest]") + { + std::cout << "Starting copy test" << std::endl; + arma::cube input = arma::randu(1, 1, 5); + arma::cube target = arma::ones(1, 1, 5); + const size_t rho = 5; + + RNN > *model1 = new RNN >(rho); + model1->Predictors() = input; + model1->Responses() = target; + model1->Add >(1, 10); + model1->Add >(10, 3, rho); + model1->Add >(); + + ens::StandardSGD opt(0.1, 1, 5, -100, false); + std::cout << "Before Training Model" << std::endl; + model1->Train(input, target, opt); + std::cout << "After Training" << std::endl; + + arma::cube predictions1; + model1->Predict(input, predictions1); + + std::cout << "After model1 predict" << std::endl; + + RNN<> model2(rho); + model2 = *model1; + delete model1; + + arma::cube predictions2; + std::cout << "After model1 delete" << std::endl; + model2.Predict(input, predictions2); + std::cout << "After model2 predictions" << std::endl; + CheckMatrices(predictions1, predictions2); + // FastLSTM<> *layer1 = new FastLSTM<>(1,2,3); + // FastLSTM<> layer2(); + // + // // Provide input of all ones. + // arma::mat input = arma::ones(3, 1); + // + // // Declaring two ouput matrices for each layer. + // arma::mat output1; + // arma::mat output2; + // + // // Forward pass through layer1. + // layer1->Forward(input, output1); + // layer2 = *layer1; + // + // // Freeing up layer1 to prevent memory leaks. + // delete layer1; + // + // // Forward pass through layer2. + // layer2.Forward(input, output2); + // + // CheckMatrices(output1, output2); + } + /** * Testing the overloaded Forward() of the LSTM layer, for retrieving the cell * state. Besides output, the overloaded function provides read access to cell From 91508c3e803597bb90c03aefacf7c34bd151eee6 Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Mon, 30 Nov 2020 19:03:50 +0530 Subject: [PATCH 100/114] Minor fixes --- .../methods/ann/layer/fast_lstm_impl.hpp | 6 - src/mlpack/tests/ann_layer_test.cpp | 146 ++++++++++++------ 2 files changed, 97 insertions(+), 55 deletions(-) diff --git a/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp b/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp index 7ffe95833b..2f90963674 100644 --- a/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp +++ b/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp @@ -53,7 +53,6 @@ FastLSTM::FastLSTM(const FastLSTM& layer) : weights(layer.weights) { // Nothing to do here. - std::cout << "Trying to copy fast LSTM layer" << std::endl; } template @@ -64,14 +63,12 @@ FastLSTM::FastLSTM(FastLSTM&& layer) : weights(std::move(layer.weights)) { // Nothing to do here. - std::cout << "Trying to move fast LSTM layer" << std::endl; } template FastLSTM& FastLSTM::operator=(const FastLSTM& layer) { - std::cout << "Trying to copy fast LSTM layer" << std::endl; if (this != &layer) { inSize = layer.inSize; @@ -79,7 +76,6 @@ FastLSTM::operator=(const FastLSTM& layer) rho = layer.rho; weights = layer.weights; } - std::cout << "Copied layer and returned" << std::endl; return *this; } @@ -87,7 +83,6 @@ template FastLSTM& FastLSTM::operator=(FastLSTM&& layer) { - std::cout << "Trying to move fast LSTM layer" << std::endl; if (this != &layer) { inSize = std::move(layer.inSize); @@ -95,7 +90,6 @@ FastLSTM::operator=(FastLSTM&& layer) rho = std::move(layer.rho); weights = std::move(layer.weights); } - std::cout << "Moved and returned" << std::endl; return *this; } diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index c3f6efc70a..4b8d8d08b0 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -31,6 +31,51 @@ using namespace mlpack; using namespace mlpack::ann; +// network1 should be allocated with `new`, and trained on some data. +template +void CheckCopyFunction(ModelType* network1, + MatType& trainData, + MatType& trainLabels, + const size_t maxEpochs) +{ + ens::RMSProp opt(0.01, 32, 0.88, 1e-8, maxEpochs * trainData.n_cols, -1); + network1->Train(trainData, trainLabels, opt); + + arma::mat predictions1; + network1->Predict(trainData, predictions1); + FFN<> network2; + network2 = *network1; + delete network1; + + // Deallocating all of network1's memory, so that + // if network2 is trying to use any of that memory. + arma::mat predictions2; + network2.Predict(trainData, predictions2); + CheckMatrices(predictions1, predictions2); +} + +// network1 should be allocated with `new`, and trained on some data. +template +void CheckMoveFunction(ModelType* network1, + MatType& trainData, + MatType& trainLabels, + const size_t maxEpochs) +{ + ens::RMSProp opt(0.01, 32, 0.88, 1e-8, maxEpochs * trainData.n_cols, -1); + network1->Train(trainData, trainLabels, opt); + + arma::mat predictions1; + network1->Predict(trainData, predictions1); + FFN<> network2(std::move(*network1)); + delete network1; + + // Deallocating all of network1's memory, so that + // if network2 is trying to use any of that memory. + arma::mat predictions2; + network2.Predict(trainData, predictions2); + CheckMatrices(predictions1, predictions2); +} + /** * Simple add module test. */ @@ -1186,61 +1231,64 @@ TEST_CASE("FastLSTMLayerParametersTest", "[ANNLayerTest]") /** * Check whether copying and moving network with FastLSTM is working or not. */ - TEST_CASE("CheckCopyFastLSTMTest", "[ANNLayerTest]") - { - std::cout << "Starting copy test" << std::endl; - arma::cube input = arma::randu(1, 1, 5); - arma::cube target = arma::ones(1, 1, 5); - const size_t rho = 5; +TEST_CASE("CheckCopyFastLSTMTest", "[ANNLayerTest]") +{ + arma::cube input = arma::randu(1, 1, 5); + arma::cube target = arma::ones(1, 1, 5); + const size_t rho = 5; - RNN > *model1 = new RNN >(rho); - model1->Predictors() = input; - model1->Responses() = target; - model1->Add >(1, 10); - model1->Add >(10, 3, rho); - model1->Add >(); + RNN > *model1 = + new RNN >(rho); + model1->Predictors() = input; + model1->Responses() = target; + model1->Add >(1, 10); + model1->Add >(10, 3, rho); + model1->Add >(); - ens::StandardSGD opt(0.1, 1, 5, -100, false); - std::cout << "Before Training Model" << std::endl; - model1->Train(input, target, opt); - std::cout << "After Training" << std::endl; + ens::StandardSGD opt(0.1, 1, 5, -100, false); + model1->Train(input, target, opt); - arma::cube predictions1; - model1->Predict(input, predictions1); + arma::cube predictions1; + model1->Predict(input, predictions1); - std::cout << "After model1 predict" << std::endl; + RNN<> model2() = *model1; + delete model1; - RNN<> model2(rho); - model2 = *model1; - delete model1; + arma::cube predictions2; + model2.Predict(input, predictions2); + CheckMatrices(predictions1, predictions2); +} - arma::cube predictions2; - std::cout << "After model1 delete" << std::endl; - model2.Predict(input, predictions2); - std::cout << "After model2 predictions" << std::endl; - CheckMatrices(predictions1, predictions2); - // FastLSTM<> *layer1 = new FastLSTM<>(1,2,3); - // FastLSTM<> layer2(); - // - // // Provide input of all ones. - // arma::mat input = arma::ones(3, 1); - // - // // Declaring two ouput matrices for each layer. - // arma::mat output1; - // arma::mat output2; - // - // // Forward pass through layer1. - // layer1->Forward(input, output1); - // layer2 = *layer1; - // - // // Freeing up layer1 to prevent memory leaks. - // delete layer1; - // - // // Forward pass through layer2. - // layer2.Forward(input, output2); - // - // CheckMatrices(output1, output2); - } + /** + * Check whether copying and moving network with FastLSTM is working or not. + */ +TEST_CASE("CheckMoveFastLSTMTest", "[ANNLayerTest]") +{ + arma::cube input = arma::randu(1, 1, 5); + arma::cube target = arma::ones(1, 1, 5); + const size_t rho = 5; + + RNN > *model1 = + new RNN >(rho); + model1->Predictors() = input; + model1->Responses() = target; + model1->Add >(1, 10); + model1->Add >(10, 3, rho); + model1->Add >(); + + ens::StandardSGD opt(0.1, 1, 5, -100, false); + model1->Train(input, target, opt); + + arma::cube predictions1; + model1->Predict(input, predictions1); + + RNN<> model2(std::move(*model1)); + delete model1; + + arma::cube predictions2; + model2.Predict(input, predictions2); + CheckMatrices(predictions1, predictions2); +} /** * Testing the overloaded Forward() of the LSTM layer, for retrieving the cell From b3f296d91524f050912e352f79e88c8aca0ab022 Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Mon, 30 Nov 2020 19:06:01 +0530 Subject: [PATCH 101/114] Removed copy and move functions --- src/mlpack/tests/ann_layer_test.cpp | 45 ----------------------------- 1 file changed, 45 deletions(-) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 4b8d8d08b0..ea5dba8c98 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -31,51 +31,6 @@ using namespace mlpack; using namespace mlpack::ann; -// network1 should be allocated with `new`, and trained on some data. -template -void CheckCopyFunction(ModelType* network1, - MatType& trainData, - MatType& trainLabels, - const size_t maxEpochs) -{ - ens::RMSProp opt(0.01, 32, 0.88, 1e-8, maxEpochs * trainData.n_cols, -1); - network1->Train(trainData, trainLabels, opt); - - arma::mat predictions1; - network1->Predict(trainData, predictions1); - FFN<> network2; - network2 = *network1; - delete network1; - - // Deallocating all of network1's memory, so that - // if network2 is trying to use any of that memory. - arma::mat predictions2; - network2.Predict(trainData, predictions2); - CheckMatrices(predictions1, predictions2); -} - -// network1 should be allocated with `new`, and trained on some data. -template -void CheckMoveFunction(ModelType* network1, - MatType& trainData, - MatType& trainLabels, - const size_t maxEpochs) -{ - ens::RMSProp opt(0.01, 32, 0.88, 1e-8, maxEpochs * trainData.n_cols, -1); - network1->Train(trainData, trainLabels, opt); - - arma::mat predictions1; - network1->Predict(trainData, predictions1); - FFN<> network2(std::move(*network1)); - delete network1; - - // Deallocating all of network1's memory, so that - // if network2 is trying to use any of that memory. - arma::mat predictions2; - network2.Predict(trainData, predictions2); - CheckMatrices(predictions1, predictions2); -} - /** * Simple add module test. */ From 83b37c4070c3292af5b65f7a255d3224d6ab8cf1 Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Mon, 30 Nov 2020 23:49:52 +0530 Subject: [PATCH 102/114] Review comments fix and code refactoring --- src/mlpack/tests/ann_layer_test.cpp | 104 ++++++++++++++++------------ 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index ea5dba8c98..9b9f1f39c8 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -31,6 +31,52 @@ using namespace mlpack; using namespace mlpack::ann; +// network1 should be allocated with `new`, and trained on some data. +template +void CheckRNNCopyFunction(ModelType* network1, + MatType& trainData, + MatType& trainLabels, + const size_t maxEpochs) +{ + arma::cube predictions1; + arma::cube predictions2; + ens::StandardSGD opt(0.1, 1, 5, -100, false); + + network1->Train(trainData, trainLabels, opt); + network1->Predict(trainData, predictions1); + + RNN<> network2 = *network1; + delete network1; + + // Deallocating all of network1's memory, so that + // if network2 is trying to use any of that memory. + network2.Predict(trainData, predictions2); + CheckMatrices(predictions1, predictions2); +} + +// network1 should be allocated with `new`, and trained on some data. +template +void CheckRNNMoveFunction(ModelType* network1, + MatType& trainData, + MatType& trainLabels, + const size_t maxEpochs) +{ + arma::cube predictions1; + arma::cube predictions2; + ens::StandardSGD opt(0.1, 1, 5, -100, false); + + network1->Train(trainData, trainLabels, opt); + network1->Predict(trainData, predictions1); + + RNN<> network2(std::move(*network1)); + delete network1; + + // Deallocating all of network1's memory, so that + // if network2 is trying to use any of that memory. + network2.Predict(trainData, predictions2); + CheckMatrices(predictions1, predictions2); +} + /** * Simple add module test. */ @@ -1186,63 +1232,33 @@ TEST_CASE("FastLSTMLayerParametersTest", "[ANNLayerTest]") /** * Check whether copying and moving network with FastLSTM is working or not. */ -TEST_CASE("CheckCopyFastLSTMTest", "[ANNLayerTest]") -{ - arma::cube input = arma::randu(1, 1, 5); - arma::cube target = arma::ones(1, 1, 5); - const size_t rho = 5; - - RNN > *model1 = - new RNN >(rho); - model1->Predictors() = input; - model1->Responses() = target; - model1->Add >(1, 10); - model1->Add >(10, 3, rho); - model1->Add >(); - - ens::StandardSGD opt(0.1, 1, 5, -100, false); - model1->Train(input, target, opt); - - arma::cube predictions1; - model1->Predict(input, predictions1); - - RNN<> model2() = *model1; - delete model1; - - arma::cube predictions2; - model2.Predict(input, predictions2); - CheckMatrices(predictions1, predictions2); -} - - /** - * Check whether copying and moving network with FastLSTM is working or not. - */ -TEST_CASE("CheckMoveFastLSTMTest", "[ANNLayerTest]") +TEST_CASE("CheckCopyMoveFastLSTMTest", "[ANNLayerTest]") { arma::cube input = arma::randu(1, 1, 5); arma::cube target = arma::ones(1, 1, 5); const size_t rho = 5; RNN > *model1 = - new RNN >(rho); + new RNN >(rho); model1->Predictors() = input; model1->Responses() = target; model1->Add >(1, 10); model1->Add >(10, 3, rho); model1->Add >(); - ens::StandardSGD opt(0.1, 1, 5, -100, false); - model1->Train(input, target, opt); + RNN > *model2 = + new RNN >(rho); + model2->Predictors() = input; + model2->Responses() = target; + model2->Add >(1, 10); + model2->Add >(10, 3, rho); + model2->Add >(); - arma::cube predictions1; - model1->Predict(input, predictions1); - - RNN<> model2(std::move(*model1)); - delete model1; - - arma::cube predictions2; - model2.Predict(input, predictions2); - CheckMatrices(predictions1, predictions2); + // Check whether copy constructor is working or not. + CheckRNNCopyFunction<>(model1, input, target, 1); + + // Check whether move constructor is working or not. + CheckRNNMoveFunction<>(model2, input, target, 1); } /** From a72c9c0a34a922a874cff5844c50fa90c0bfc773 Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Tue, 1 Dec 2020 12:49:26 +0530 Subject: [PATCH 103/114] Minor fixes --- src/mlpack/tests/ann_layer_test.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 9b9f1f39c8..515b91078a 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -40,7 +40,7 @@ void CheckRNNCopyFunction(ModelType* network1, { arma::cube predictions1; arma::cube predictions2; - ens::StandardSGD opt(0.1, 1, 5, -100, false); + ens::StandardSGD opt(0.1, 1, maxEpochs * trainData.n_cols, -100, false); network1->Train(trainData, trainLabels, opt); network1->Predict(trainData, predictions1); @@ -63,7 +63,7 @@ void CheckRNNMoveFunction(ModelType* network1, { arma::cube predictions1; arma::cube predictions2; - ens::StandardSGD opt(0.1, 1, 5, -100, false); + ens::StandardSGD opt(0.1, 1, maxEpochs * trainData.n_cols, -100, false); network1->Train(trainData, trainLabels, opt); network1->Predict(trainData, predictions1); @@ -1242,21 +1242,23 @@ TEST_CASE("CheckCopyMoveFastLSTMTest", "[ANNLayerTest]") new RNN >(rho); model1->Predictors() = input; model1->Responses() = target; + model1->Add >(); model1->Add >(1, 10); model1->Add >(10, 3, rho); model1->Add >(); + // Check whether copy constructor is working or not. + CheckRNNCopyFunction<>(model1, input, target, 1); + RNN > *model2 = new RNN >(rho); model2->Predictors() = input; model2->Responses() = target; + model2->Add >(); model2->Add >(1, 10); model2->Add >(10, 3, rho); model2->Add >(); - // Check whether copy constructor is working or not. - CheckRNNCopyFunction<>(model1, input, target, 1); - // Check whether move constructor is working or not. CheckRNNMoveFunction<>(model2, input, target, 1); } From f5340b0f2de382c6e835a6fa90f187c26305a622 Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Tue, 1 Dec 2020 19:52:58 -0500 Subject: [PATCH 104/114] Update src/mlpack/methods/ann/layer/concatenate_impl.hpp Co-authored-by: kartikdutt18 <39593019+kartikdutt18@users.noreply.github.com> --- src/mlpack/methods/ann/layer/concatenate_impl.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mlpack/methods/ann/layer/concatenate_impl.hpp b/src/mlpack/methods/ann/layer/concatenate_impl.hpp index 10a6015de1..ba0060aa5f 100644 --- a/src/mlpack/methods/ann/layer/concatenate_impl.hpp +++ b/src/mlpack/methods/ann/layer/concatenate_impl.hpp @@ -57,6 +57,7 @@ operator=(const Concatenate& layer) delta = layer.delta; concat = layer.concat; } + return *this; } From 96b04c2a94ee8fef5ede1a709f47ae0ed9fe326f Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Thu, 3 Dec 2020 15:45:59 +0530 Subject: [PATCH 105/114] Review fixes --- src/mlpack/methods/ann/rnn.hpp | 7 +++++-- src/mlpack/methods/ann/rnn_impl.hpp | 19 +++++++++++------- src/mlpack/tests/ann_layer_test.cpp | 20 +++++++++---------- src/mlpack/tests/feedforward_network_test.cpp | 10 +++++----- 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/mlpack/methods/ann/rnn.hpp b/src/mlpack/methods/ann/rnn.hpp index 0e653ea0f9..949aecee9b 100644 --- a/src/mlpack/methods/ann/rnn.hpp +++ b/src/mlpack/methods/ann/rnn.hpp @@ -76,8 +76,11 @@ class RNN //! Move constructor. RNN(RNN&&); - //! Copy/move assignment operator. - RNN& operator = (RNN); + //! Copy assignment operator. + RNN& operator=(const RNN&); + + //! Move assignment operator + RNN& operator=(RNN&&); //! Destructor to release allocated memory. ~RNN(); diff --git a/src/mlpack/methods/ann/rnn_impl.hpp b/src/mlpack/methods/ann/rnn_impl.hpp index 66bef0855b..65ab29ad4f 100644 --- a/src/mlpack/methods/ann/rnn_impl.hpp +++ b/src/mlpack/methods/ann/rnn_impl.hpp @@ -54,22 +54,27 @@ template::RNN( const RNN& network) : rho(network.rho), + outputLayer(network.outputLayer), initializeRule(network.initializeRule), inputSize(network.inputSize), - outputLayer(network.outputLayer), outputSize(network.outputSize), targetSize(network.targetSize), reset(network.reset), single(network.single), + parameter(network.parameter), numFunctions(network.numFunctions), - deterministic(network.deterministic), - parameter(network.parameter) + deterministic(network.deterministic) { for (size_t i = 0; i < network.network.size(); ++i) { this->network.push_back(boost::apply_visitor(copyVisitor, network.network[i])); - boost::apply_visitor(resetVisitor, this->network[i]); + boost::apply_visitor(resetVisitor, this->network.back()); + } + ResetCells(); + if (parameter.is_empty()) + { + ResetParameters(); } } @@ -78,16 +83,16 @@ template::RNN( RNN&& network) : rho(std::move(network.rho)), + outputLayer(std::move(network.outputLayer)), initializeRule(std::move(network.initializeRule)), inputSize(std::move(network.inputSize)), - outputLayer(std::move(network.outputLayer)), outputSize(std::move(network.outputSize)), targetSize(std::move(network.targetSize)), reset(std::move(network.reset)), single(std::move(network.single)), + parameter(std::move(network.parameter)), numFunctions(std::move(network.numFunctions)), - deterministic(std::move(network.deterministic)), - parameter(std::move(network.parameter)) + deterministic(std::move(network.deterministic)) { this->network = std::move(network.network); } diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 515b91078a..3950c1a2fd 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -40,7 +40,7 @@ void CheckRNNCopyFunction(ModelType* network1, { arma::cube predictions1; arma::cube predictions2; - ens::StandardSGD opt(0.1, 1, maxEpochs * trainData.n_cols, -100, false); + ens::StandardSGD opt(0.1, 1, maxEpochs * trainData.n_slices, -100, false); network1->Train(trainData, trainLabels, opt); network1->Predict(trainData, predictions1); @@ -48,8 +48,8 @@ void CheckRNNCopyFunction(ModelType* network1, RNN<> network2 = *network1; delete network1; - // Deallocating all of network1's memory, so that - // if network2 is trying to use any of that memory. + // Deallocating all of network1's memory, so that network2 does not use any + // of that memory. network2.Predict(trainData, predictions2); CheckMatrices(predictions1, predictions2); } @@ -63,7 +63,7 @@ void CheckRNNMoveFunction(ModelType* network1, { arma::cube predictions1; arma::cube predictions2; - ens::StandardSGD opt(0.1, 1, maxEpochs * trainData.n_cols, -100, false); + ens::StandardSGD opt(0.1, 1, maxEpochs * trainData.n_slices, -100, false); network1->Train(trainData, trainLabels, opt); network1->Predict(trainData, predictions1); @@ -71,8 +71,8 @@ void CheckRNNMoveFunction(ModelType* network1, RNN<> network2(std::move(*network1)); delete network1; - // Deallocating all of network1's memory, so that - // if network2 is trying to use any of that memory. + // Deallocating all of network1's memory, so that network2 does not use any + // of that memory. network2.Predict(trainData, predictions2); CheckMatrices(predictions1, predictions2); } @@ -1239,7 +1239,7 @@ TEST_CASE("CheckCopyMoveFastLSTMTest", "[ANNLayerTest]") const size_t rho = 5; RNN > *model1 = - new RNN >(rho); + new RNN >(rho); model1->Predictors() = input; model1->Responses() = target; model1->Add >(); @@ -1247,9 +1247,6 @@ TEST_CASE("CheckCopyMoveFastLSTMTest", "[ANNLayerTest]") model1->Add >(10, 3, rho); model1->Add >(); - // Check whether copy constructor is working or not. - CheckRNNCopyFunction<>(model1, input, target, 1); - RNN > *model2 = new RNN >(rho); model2->Predictors() = input; @@ -1259,6 +1256,9 @@ TEST_CASE("CheckCopyMoveFastLSTMTest", "[ANNLayerTest]") model2->Add >(10, 3, rho); model2->Add >(); + // Check whether copy constructor is working or not. + CheckRNNCopyFunction<>(model1, input, target, 1); + // Check whether move constructor is working or not. CheckRNNMoveFunction<>(model2, input, target, 1); } diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index 774bb53f18..81086a019e 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -71,8 +71,8 @@ void CheckCopyFunction(ModelType* network1, network2 = *network1; delete network1; - // Deallocating all of network1's memory, so that - // if network2 is trying to use any of that memory. + // Deallocating all of network1's memory, so that network2 does not use any + // of that memory. arma::mat predictions2; network2.Predict(trainData, predictions2); CheckMatrices(predictions1, predictions2); @@ -93,8 +93,8 @@ void CheckMoveFunction(ModelType* network1, FFN<> network2(std::move(*network1)); delete network1; - // Deallocating all of network1's memory, so that - // if network2 is trying to use any of that memory. + // Deallocating all of network1's memory, so that network2 does not use any + // of that memory. arma::mat predictions2; network2.Predict(trainData, predictions2); CheckMatrices(predictions1, predictions2); @@ -171,7 +171,7 @@ TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") model1->Add>(10, 5); model1->Add >(5, 1); model1->Add>(); - + // Check whether copy constructor is working or not. CheckCopyFunction<>(model1, input, output, 1); From 376a44fe85cfb80ad80bcab7093c731073c41ae4 Mon Sep 17 00:00:00 2001 From: Nippun Sharma <53967069+NippunSharma@users.noreply.github.com> Date: Thu, 3 Dec 2020 18:16:46 +0530 Subject: [PATCH 106/114] add assert in spatial_dropout_impl.hpp --- src/mlpack/methods/ann/layer/spatial_dropout_impl.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mlpack/methods/ann/layer/spatial_dropout_impl.hpp b/src/mlpack/methods/ann/layer/spatial_dropout_impl.hpp index 79114d2471..4bd2cb767b 100644 --- a/src/mlpack/methods/ann/layer/spatial_dropout_impl.hpp +++ b/src/mlpack/methods/ann/layer/spatial_dropout_impl.hpp @@ -51,6 +51,9 @@ template void SpatialDropout::Forward( const arma::Mat& input, arma::Mat& output) { + Log::Assert(input.n_rows % size == 0, "Input features must be divisible \ + by feature maps."); + if (!reset) { batchSize = input.n_cols; From 57b93807d0baeb311c4ef0f3ea310e3a50adbe82 Mon Sep 17 00:00:00 2001 From: Nippun Sharma <53967069+NippunSharma@users.noreply.github.com> Date: Thu, 3 Dec 2020 18:22:23 +0530 Subject: [PATCH 107/114] add assert to virtual_batch_norm_impl.hpp --- src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp b/src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp index 2b93960b82..7bd20415a2 100644 --- a/src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp +++ b/src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp @@ -67,6 +67,9 @@ template void VirtualBatchNorm::Forward( const arma::Mat& input, arma::Mat& output) { + Log::Assert(input.n_rows % size == 0, "Input features must be divisible \ + by feature maps."); + inputParameter = input; arma::mat inputMean = arma::mean(input, 1); arma::mat inputMeanSquared = arma::mean(arma::square(input), 1); From a79cf8dd2dc66fbfdabf37610c366fab4c4a98df Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Thu, 3 Dec 2020 19:14:17 +0530 Subject: [PATCH 108/114] Fix for failing tests --- .../methods/ann/layer/fast_lstm_impl.hpp | 40 ++++++++++++++++++- src/mlpack/methods/ann/rnn_impl.hpp | 5 --- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp b/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp index 2f90963674..752b132ae4 100644 --- a/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp +++ b/src/mlpack/methods/ann/layer/fast_lstm_impl.hpp @@ -50,7 +50,16 @@ FastLSTM::FastLSTM(const FastLSTM& layer) : inSize(layer.inSize), outSize(layer.outSize), rho(layer.rho), - weights(layer.weights) + forwardStep(layer.forwardStep), + backwardStep(layer.backwardStep), + gradientStep(layer.gradientStep), + weights(layer.weights), + batchSize(layer.batchSize), + batchStep(layer.batchStep), + gradientStepIdx(layer.gradientStepIdx), + grad(layer.grad), + rhoSize(layer.rho), + bpttSteps(layer.bpttSteps) { // Nothing to do here. } @@ -60,7 +69,16 @@ FastLSTM::FastLSTM(FastLSTM&& layer) : inSize(std::move(layer.inSize)), outSize(std::move(layer.outSize)), rho(std::move(layer.rho)), - weights(std::move(layer.weights)) + forwardStep(std::move(layer.forwardStep)), + backwardStep(std::move(layer.backwardStep)), + gradientStep(std::move(layer.gradientStep)), + weights(std::move(layer.weights)), + batchSize(std::move(layer.batchSize)), + batchStep(std::move(layer.batchStep)), + gradientStepIdx(std::move(layer.gradientStepIdx)), + grad(std::move(layer.grad)), + rhoSize(std::move(layer.rho)), + bpttSteps(std::move(layer.bpttSteps)) { // Nothing to do here. } @@ -74,7 +92,16 @@ FastLSTM::operator=(const FastLSTM& layer) inSize = layer.inSize; outSize = layer.outSize; rho = layer.rho; + forwardStep = layer.forwardStep; + backwardStep = layer.backwardStep; + gradientStep = layer.gradientStep; weights = layer.weights; + batchSize = layer.batchSize; + batchStep = layer.batchStep; + gradientStepIdx = layer.gradientStepIdx; + grad = layer.grad; + rhoSize = layer.rho; + bpttSteps = layer.bpttSteps; } return *this; } @@ -88,7 +115,16 @@ FastLSTM::operator=(FastLSTM&& layer) inSize = std::move(layer.inSize); outSize = std::move(layer.outSize); rho = std::move(layer.rho); + forwardStep = std::move(layer.forwardStep); + backwardStep = std::move(layer.backwardStep); + gradientStep = std::move(layer.gradientStep); weights = std::move(layer.weights); + batchSize = std::move(layer.batchSize); + batchStep = std::move(layer.batchStep); + gradientStepIdx = std::move(layer.gradientStepIdx); + grad = std::move(layer.grad); + rhoSize = std::move(layer.rho); + bpttSteps = std::move(layer.bpttSteps); } return *this; } diff --git a/src/mlpack/methods/ann/rnn_impl.hpp b/src/mlpack/methods/ann/rnn_impl.hpp index 65ab29ad4f..6c909585c7 100644 --- a/src/mlpack/methods/ann/rnn_impl.hpp +++ b/src/mlpack/methods/ann/rnn_impl.hpp @@ -71,11 +71,6 @@ RNN::RNN( network.network[i])); boost::apply_visitor(resetVisitor, this->network.back()); } - ResetCells(); - if (parameter.is_empty()) - { - ResetParameters(); - } } template Date: Fri, 4 Dec 2020 11:39:50 +0530 Subject: [PATCH 109/114] Review fixes --- src/mlpack/methods/ann/rnn_impl.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/rnn_impl.hpp b/src/mlpack/methods/ann/rnn_impl.hpp index 6c909585c7..75749982f5 100644 --- a/src/mlpack/methods/ann/rnn_impl.hpp +++ b/src/mlpack/methods/ann/rnn_impl.hpp @@ -87,9 +87,10 @@ RNN::RNN( single(std::move(network.single)), parameter(std::move(network.parameter)), numFunctions(std::move(network.numFunctions)), - deterministic(std::move(network.deterministic)) + deterministic(std::move(network.deterministic)), + network(std::move(network.network)) { - this->network = std::move(network.network); + // Nothing to do here. } template Date: Fri, 4 Dec 2020 15:06:32 +0530 Subject: [PATCH 110/114] Added fail messages and comment fix --- src/mlpack/tests/callback_test.cpp | 8 ++++---- src/mlpack/tests/svd_batch_test.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mlpack/tests/callback_test.cpp b/src/mlpack/tests/callback_test.cpp index e66fc1e051..0d532df67c 100644 --- a/src/mlpack/tests/callback_test.cpp +++ b/src/mlpack/tests/callback_test.cpp @@ -42,9 +42,9 @@ TEST_CASE("FFNCallbackTest", "[CallbackTest]") arma::mat data; arma::mat labels; - if (!data::Load("lab1.csv", data, true)) + if (!data::Load("lab1.csv", data)) FAIL("Cannot load test dataset lab1.csv!"); - if (!data::Load("lab3.csv", labels, true)) + if (!data::Load("lab3.csv", labels)) FAIL("Cannot load test dataset lab3.csv!"); FFN, RandomInitialization> model; @@ -68,9 +68,9 @@ TEST_CASE("FFNWithOptimizerCallbackTest", "[CallbackTest]") arma::mat data; arma::mat labels; - if (!data::Load("lab1.csv", data, true)) + if (!data::Load("lab1.csv", data)) FAIL("Cannot load test dataset lab1.csv!"); - if (!data::Load("lab3.csv", labels, true)) + if (!data::Load("lab3.csv", labels)) FAIL("Cannot load test dataset lab3.csv!"); FFN, RandomInitialization> model; diff --git a/src/mlpack/tests/svd_batch_test.cpp b/src/mlpack/tests/svd_batch_test.cpp index bac6df4917..ab9eb99f5a 100644 --- a/src/mlpack/tests/svd_batch_test.cpp +++ b/src/mlpack/tests/svd_batch_test.cpp @@ -70,7 +70,8 @@ class SpecificRandomInitialization TEST_CASE("SVDBatchMomentumTest", "[SVDBatchTest]") { mat dataset; - data::Load("GroupLensSmall.csv", dataset); + if (data::Load("GroupLensSmall.csv", dataset)) + FAIL("Cannot load dataset GroupLensSmall.csv!"); // Generate list of locations for batch insert constructor for sparse // matrices. @@ -117,7 +118,8 @@ TEST_CASE("SVDBatchMomentumTest", "[SVDBatchTest]") TEST_CASE("SVDBatchRegularizationTest", "[SVDBatchTest]") { mat dataset; - data::Load("GroupLensSmall.csv", dataset); + if (data::Load("GroupLensSmall.csv", dataset)) + FAIL("Cannot load dataset GroupLensSmall.csv!"); // Generate list of locations for batch insert constructor for sparse // matrices. From 6cad509c2fe31c4239f111165c4e8f23b06fb697 Mon Sep 17 00:00:00 2001 From: Anush V Kini Date: Fri, 4 Dec 2020 16:04:58 +0530 Subject: [PATCH 111/114] Minor fix --- src/mlpack/tests/svd_batch_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/tests/svd_batch_test.cpp b/src/mlpack/tests/svd_batch_test.cpp index ab9eb99f5a..41b005a28d 100644 --- a/src/mlpack/tests/svd_batch_test.cpp +++ b/src/mlpack/tests/svd_batch_test.cpp @@ -70,7 +70,7 @@ class SpecificRandomInitialization TEST_CASE("SVDBatchMomentumTest", "[SVDBatchTest]") { mat dataset; - if (data::Load("GroupLensSmall.csv", dataset)) + if (!data::Load("GroupLensSmall.csv", dataset)) FAIL("Cannot load dataset GroupLensSmall.csv!"); // Generate list of locations for batch insert constructor for sparse @@ -118,7 +118,7 @@ TEST_CASE("SVDBatchMomentumTest", "[SVDBatchTest]") TEST_CASE("SVDBatchRegularizationTest", "[SVDBatchTest]") { mat dataset; - if (data::Load("GroupLensSmall.csv", dataset)) + if (!data::Load("GroupLensSmall.csv", dataset)) FAIL("Cannot load dataset GroupLensSmall.csv!"); // Generate list of locations for batch insert constructor for sparse From 117f18cf7dfcffd75bc034690d1e7931bd9cfe2e Mon Sep 17 00:00:00 2001 From: Matheus Gomes Date: Thu, 26 Nov 2020 20:06:13 +0000 Subject: [PATCH 112/114] Added Visual Studio CMake integration build guide to docs. --- doc/guide/build_windows.hpp | 118 +++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 3 deletions(-) diff --git a/doc/guide/build_windows.hpp b/doc/guide/build_windows.hpp index e150cc3b54..41eb911659 100644 --- a/doc/guide/build_windows.hpp +++ b/doc/guide/build_windows.hpp @@ -9,8 +9,13 @@ @section build_windows_intro Introduction -This tutorial will show you how to build mlpack for Windows from source, so you can -later create your own C++ applications. Before you try building mlpack, you may +This tutorial will show you how to build mlpack for Windows from source, so +you can later create your own C++ applications, using two different ways: + + - Using CMake to generate an intermeditate Visual Studio solution (`.sln`). + - @ref build_visual_studio_cmake_integration "Use Visual Studio's CMake integration to directly build from the `CMakeLists`." + +Before you try building mlpack, you may want to install mlpack using vcpkg for Windows. If you don't want to install using vcpkg, skip this section and continue with the build tutorial. @@ -78,6 +83,23 @@ system environment variables or manually set the PATH before running CMake) - Click on OpenBlas and check the mlpack project, then click Install - Once it has finished installing, close Visual Studio + Building OpenBLAS from Source + +Unfortunately, the support for building `LAPACK` and `BLAS` on Windows is quite poor, due to the need for Fortran +compiler and libraries. The easiest method to get the necessary `BLAS/LAPACK` libraries built on Windows is to +compile OpenBLAS with LLVM's `clang-cl` and `flang` to produce the required static library (`.lib`) files +compatible with the MSVC compiler. A comprehensive guide on the +compilation +of OpenBLAS for Windows can be found here. + +One could always download prebuilt `LAPACK` and `BLAS` libraries for Windows. However, there are few official +sources, and some of those libraries may require further `dll`s at runtime which may not be available in your +system. + +It you choose to build `OpenBLAS` from source, make sure that `LAPACK` functions are also built. Finally, make +sure that the `openblas.lib` library is linked in your `Armadillo` build (see below), as well as the library +path used for the CMake options `BLAS_LIBRARIES` and `LAPACK_LIBRARIES` in the mlpack CMake project. + Boost Dependency You can either get Boost via NuGet or you can download the prebuilt Windows binaries separately. @@ -110,7 +132,7 @@ compiler version, check if the Visual Studio compiler and Windows SDK are instal - Build > Build Solution - Once it has successfully finished, close Visual Studio -@section build_windows_mlpack Building mlpack +@section build_windows_mlpack Building mlpack with CMake-Generated Solution - Create a "build" directory into "C:\mlpack\mlpack\" - You can generate the project using either cmake via command line or GUI. If you prefer to use GUI, refer to the \ref build_windows_appendix "appendix" @@ -129,6 +151,96 @@ cmake -G "Visual Studio 16 2019" -A x64 -DBLAS_LIBRARIES:FILEPATH="C:/mlpack/mlp You are ready to create your first application, take a look at the @ref sample_ml_app "Sample C++ ML App" +@section build_visual_studio_cmake_integration Building mlpack with Visual Studio's CMake Integration + +This project can be directly built from the `CMakeLists.txt` with the latest version of MS Visual Studio, +given you have CMake integration via the +C++ +CMake tools for Windows. To open the CMake project with Visual Studio, select File->Open->CMake +in the top menu, followed by selecting the root `CMakeLists.txt` located in mlpack's root directory. + +In order to allow Visual Studio to configure the CMake project, the CMake configuration json will have +to be edited to provide the relevant options +shown in the `README` needed to find all the dependencies. The options that you +must provide to Visual Studio's CMake are: + + - `ARMADILLO_INCLUDE_DIR` + - `ARMADILLO_LIBRARY` + - `BOOST_ROOT` + - `CEREAL_INCLUDE_DIR` + - `BLAS_LIBRARIES` + - `LAPACK_LIBRARIES` + +The CMake configuration json can be editted in Visual Studio by right clicking the root `CMakeLists.txt` +in the project view, selecting CMake settings for mlpack and finally clicking on edit JSON. +Adding a new CMake option can be done by adding object fields with the following format to the variables +array in the `CMakeSettings.json`: + +@code +{ + "name": "options_name_string", + "value": "options_value_string", + "type" : "{BOOL|FILEPATH|PATH|STRING}" +} +@endcode + +Here is a full example of the `CMakeSettings.json`file: + +@code +{ + "configurations": [ + { + "name": "x64-Debug (default)", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "variables": [ + { + "name": "ARMADILLO_INCLUDE_DIR", + "value": "PATH/TO/CPP/DEPENDENCY/armadillo-10.1.2/include", + "type": "PATH" + }, + { + "name": "ARMADILLO_LIBBRARY", + "value": "PATH/TO/CPP/DEPENDENCY/armadillo-10.1.2/lib/armadillo.lib", + "type": "PATH" + }, + { + "name": "CEREAL_INCLUDE_DIR", + "value": "PATH/TO/CPP/DEPENDENCY/cereal-1.3.0/include", + "type": "PATH" + }, + { + "name": "BUILD_ROOT", + "value": "PATH/TO/CPP/DEPENDENCY/boost_1_66_0", + "type": "PATH" + }, + { + "name": "BOOST_INCLUDEDIR", + "value": "PATH/TO/CPP/DEPENDENCY/boost_1_66_0", + "type": "PATH" + }, + { + "name": "BLAS_LIBRARIES", + "value": "PATH/TO/CPP/DEPENDENCY/OpenBLAS/lib/openblas.lib", + "type": "PATH" + }, + { + "name": "LAPACK_LIBRARIES", + "value": "PATH/TO/CPP/DEPENDENCY/OpenBLAS/lib/openblas.lib", + "type": "PATH" + } + ] + } + ] +} +@endcode + @section build_windows_appendix Appendix If you prefer to use cmake GUI, follow these instructions: From eb47d8c4af1963db548d555e914b97856e398b01 Mon Sep 17 00:00:00 2001 From: Alex Nguyen Date: Sat, 5 Dec 2020 10:54:08 -0500 Subject: [PATCH 113/114] static code check error fix --- src/mlpack/methods/ann/layer/concatenate_impl.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/concatenate_impl.hpp b/src/mlpack/methods/ann/layer/concatenate_impl.hpp index ba0060aa5f..bfede6c162 100644 --- a/src/mlpack/methods/ann/layer/concatenate_impl.hpp +++ b/src/mlpack/methods/ann/layer/concatenate_impl.hpp @@ -20,7 +20,8 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { template -Concatenate::Concatenate() +Concatenate::Concatenate() : + inRows(0) { // Nothing to do here. } From b35ad950e9449e8ab7c2b710fdc50173f41d88ad Mon Sep 17 00:00:00 2001 From: Alex Nguyen <60036798+rxng8@users.noreply.github.com> Date: Sat, 5 Dec 2020 14:59:37 -0500 Subject: [PATCH 114/114] Update src/mlpack/tests/feedforward_network_test.cpp Co-authored-by: Marcus Edel --- src/mlpack/tests/feedforward_network_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index 30bfd1d226..f7c0b99ea9 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -271,7 +271,7 @@ TEST_CASE("CheckCopyMovingConcatenateTest", "[FeedForwardNetworkTest]") // Check whether copy constructor is working or not. CheckCopyFunction<>(model1, input, output, 1); - // check moving constructor. + // Check moving constructor. FFN> *model2 = new FFN>(); model2->Predictors() = input; model2->Responses() = output;