Merge branch 'master' of https://github.com/mrdaybird/mlpack into fix_logsoftmax
This commit is contained in:
+8
-1
@@ -1,13 +1,17 @@
|
||||
### mlpack ?.?.?
|
||||
###### ????-??-??
|
||||
|
||||
### mlpack 4.1.0
|
||||
###### 2023-04-26
|
||||
|
||||
* Adapt HardTanH layer (#3454).
|
||||
|
||||
* Adapt Softmin layer for new neural network API (#3437).
|
||||
|
||||
* Adapt PReLU layer for new neural network API (#3420).
|
||||
|
||||
* Add CF decomposition methods: `QUIC_SVDPolicy` and `BlockKrylovSVDPolicy` (#3413, #3404).
|
||||
* Add CF decomposition methods: `QUIC_SVDPolicy` and `BlockKrylovSVDPolicy`
|
||||
(#3413, #3404).
|
||||
|
||||
* Update outdated code in tutorials (#3398, #3401).
|
||||
|
||||
@@ -19,6 +23,9 @@
|
||||
|
||||
* Avoid deprecation warnings in Armadillo 11.4.4+ (#3405).
|
||||
|
||||
* Issue runtime error when serialization of neural networks is attempted but
|
||||
`MLPACK_ENABLE_ANN_SERIALIZATION` is not defined (#3451).
|
||||
|
||||
### mlpack 4.0.1
|
||||
###### 2022-12-23
|
||||
* Fix mapping of categorical data for Julia bindings (#3305).
|
||||
|
||||
@@ -21,7 +21,7 @@ src="https://cdn.rawgit.com/mlpack/mlpack.org/e7d36ed8/mlpack-black.svg" style="
|
||||
<p align="center">
|
||||
<em>
|
||||
Download:
|
||||
<a href="https://www.mlpack.org/files/mlpack-4.0.1.tar.gz">current stable version (4.0.1)</a>
|
||||
<a href="https://www.mlpack.org/files/mlpack-4.1.0.tar.gz">current stable version (4.1.0)</a>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
@@ -180,6 +180,8 @@ g++ -O3 -std=c++14 -o my_program my_program.cpp -larmadillo -fopenmp
|
||||
|
||||
Note that if you want to serialize (save or load) neural networks, you should
|
||||
add `#define MLPACK_ENABLE_ANN_SERIALIZATION` before including `<mlpack.hpp>`.
|
||||
If you don't define `MLPACK_ENABLE_ANN_SERIALIZATION` and your code serializes a
|
||||
neural network, a compilation error will occur.
|
||||
|
||||
See the [C++ quickstart](doc/quickstart/cpp.md) and the
|
||||
[examples](https://github.com/mlpack/examples) repository for some examples of
|
||||
@@ -198,7 +200,8 @@ reduce compilation time:
|
||||
* Only use the `MLPACK_ENABLE_ANN_SERIALIZATION` definition if you are
|
||||
serializing neural networks in your code. When this define is enabled,
|
||||
compilation time will increase significantly, as the compiler must generate
|
||||
code for every possible type of layer.
|
||||
code for every possible type of layer. (The large amount of extra
|
||||
compilation overhead is why this is not enabled by default.)
|
||||
|
||||
* If you are using mlpack in multiple .cpp files, consider using [`extern
|
||||
templates`](https://isocpp.org/wiki/faq/cpp11-language-templates) so that the
|
||||
@@ -252,7 +255,7 @@ build in parallel; e.g., `make -j4` will use 4 cores to build.
|
||||
|
||||
mlpack's Python bindings are available on
|
||||
[PyPI](https://pypi.org/project/mlpack) and
|
||||
[conda-forge](https://conda-forge.org/packages/mlpack), and can be installed
|
||||
[conda-forge](https://anaconda.org/conda-forge/mlpack), and can be installed
|
||||
with either `pip install mlpack` or `conda install -c conda-forge mlpack`.
|
||||
These sources are recommended, as building the Python bindings by hand can be
|
||||
complex.
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>Default</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\mlpack\armadillo-11.4.1\include;C:\mlpack\mlpack-4.0.1\include\;C:\mlpack\cereal-1.3.2\include;C:\mlpack\ensmallen-2.19.0\include\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\mlpack\armadillo-11.4.1\include;C:\mlpack\mlpack-4.1.0\include\;C:\mlpack\cereal-1.3.2\include;C:\mlpack\ensmallen-2.19.0\include\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
|
||||
@@ -261,5 +261,5 @@ If you are facing issues during the build process of mlpack, you may take a look
|
||||
at other third-party tutorials for Windows, but they may be out of date:
|
||||
|
||||
* [Github wiki Windows Build page](https://github.com/mlpack/mlpack/wiki/WindowsBuild)
|
||||
* [Keon's tutorial for mlpack 2.0.3](http://keon.io/mlpack-on-windows)
|
||||
* [Keon's tutorial for mlpack 2.0.3](https://keon.github.io/mlpack-on-windows/)
|
||||
* [Kirizaki's tutorial for mlpack 2](https://overdosedblog.wordpress.com/2016/08/15/once_again/)
|
||||
|
||||
@@ -27,13 +27,13 @@ dependencies in Release Mode).
|
||||
- Under C/C++ > General > Additional Include Directories add:
|
||||
```
|
||||
- C:\mlpack\armadillo-9.800.3\include
|
||||
- C:\mlpack\mlpack-4.0.1\src
|
||||
- C:\mlpack\mlpack-4.1.0\src
|
||||
- C:\mlpack\ensmallen-2.19.0\include
|
||||
- C:\mlpack\cereal-3.1.2\include
|
||||
```
|
||||
- Under Build Events > Post-Build Event > Command Line add:
|
||||
```
|
||||
- xcopy /y "C:\mlpack\mlpack-4.0.1\packages\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll" $(OutDir)
|
||||
- xcopy /y "C:\mlpack\mlpack-4.1.0\packages\OpenBLAS.0.2.14.1\lib\native\bin\x64\*.dll" $(OutDir)
|
||||
```
|
||||
|
||||
*Note*: recent versions of Visual Studio set "Conformance Mode" enabled by
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
// The version of mlpack. If this is a git repository, this will be a version
|
||||
// with higher number than the most recent release.
|
||||
#define MLPACK_VERSION_MAJOR 4
|
||||
#define MLPACK_VERSION_MINOR 0
|
||||
#define MLPACK_VERSION_PATCH 2
|
||||
#define MLPACK_VERSION_MINOR 1
|
||||
#define MLPACK_VERSION_PATCH 1
|
||||
|
||||
// The name of the version (for use by --version).
|
||||
namespace mlpack {
|
||||
|
||||
@@ -374,34 +374,46 @@ void FFN<
|
||||
MatType
|
||||
>::serialize(Archive& ar, const uint32_t /* version */)
|
||||
{
|
||||
// Serialize the output layer and initialization rule.
|
||||
ar(CEREAL_NVP(outputLayer));
|
||||
ar(CEREAL_NVP(initializeRule));
|
||||
#ifndef MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
// Note: if you define MLPACK_IGNORE_ANN_SERIALIZATION_WARNING, you had
|
||||
// better ensure that every layer you are serializing has had
|
||||
// CEREAL_REGISTER_TYPE() called somewhere. See layer/serialization.hpp for
|
||||
// more information.
|
||||
#ifndef MLPACK_ANN_IGNORE_SERIALIZATION_WARNING
|
||||
throw std::runtime_error("Cannot serialize a neural network unless "
|
||||
"MLPACK_ENABLE_ANN_SERIALIZATION is defined! See the \"Additional "
|
||||
"build options\" section of the README for more information.");
|
||||
#endif
|
||||
#else
|
||||
// Serialize the output layer and initialization rule.
|
||||
ar(CEREAL_NVP(outputLayer));
|
||||
ar(CEREAL_NVP(initializeRule));
|
||||
|
||||
// Serialize the network itself.
|
||||
ar(CEREAL_NVP(network));
|
||||
ar(CEREAL_NVP(parameters));
|
||||
// Serialize the network itself.
|
||||
ar(CEREAL_NVP(network));
|
||||
ar(CEREAL_NVP(parameters));
|
||||
|
||||
// Serialize the expected input size.
|
||||
ar(CEREAL_NVP(inputDimensions));
|
||||
// Serialize the expected input size.
|
||||
ar(CEREAL_NVP(inputDimensions));
|
||||
|
||||
// If we are loading, we need to initialize the weights.
|
||||
if (cereal::is_loading<Archive>())
|
||||
{
|
||||
// We can clear these members, since it's not possible to serialize in the
|
||||
// middle of training and resume.
|
||||
predictors.clear();
|
||||
responses.clear();
|
||||
// If we are loading, we need to initialize the weights.
|
||||
if (cereal::is_loading<Archive>())
|
||||
{
|
||||
// We can clear these members, since it's not possible to serialize in the
|
||||
// middle of training and resume.
|
||||
predictors.clear();
|
||||
responses.clear();
|
||||
|
||||
networkOutput.clear();
|
||||
networkDelta.clear();
|
||||
networkOutput.clear();
|
||||
networkDelta.clear();
|
||||
|
||||
layerMemoryIsSet = false;
|
||||
inputDimensionsAreSet = false;
|
||||
layerMemoryIsSet = false;
|
||||
inputDimensionsAreSet = false;
|
||||
|
||||
// The weights in `parameters` will be correctly set for each layer in the
|
||||
// first call to Forward().
|
||||
}
|
||||
// The weights in `parameters` will be correctly set for each layer in the
|
||||
// first call to Forward().
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename OutputLayerType,
|
||||
|
||||
@@ -71,7 +71,7 @@ class NetworkInitialization
|
||||
// Initialize the layer with the specified parameter/weight
|
||||
// initialization rule.
|
||||
const size_t weight = network[i]->WeightSize();
|
||||
arma::Mat<eT> tmp = arma::mat(parameters.memptr() + offset,
|
||||
arma::Mat<eT> tmp = arma::Mat<eT>(parameters.memptr() + offset,
|
||||
weight, 1, false, false);
|
||||
initializeRule.Initialize(tmp, tmp.n_elem, 1);
|
||||
|
||||
|
||||
@@ -290,17 +290,29 @@ void RNN<
|
||||
>::serialize(
|
||||
Archive& ar, const uint32_t /* version */)
|
||||
{
|
||||
ar(CEREAL_NVP(bpttSteps));
|
||||
ar(CEREAL_NVP(single));
|
||||
ar(CEREAL_NVP(network));
|
||||
#ifndef MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
// Note: if you define MLPACK_IGNORE_ANN_SERIALIZATION_WARNING, you had
|
||||
// better ensure that every layer you are serializing has had
|
||||
// CEREAL_REGISTER_TYPE() called somewhere. See layer/serialization.hpp for
|
||||
// more information.
|
||||
#ifndef MLPACK_IGNORE_ANN_SERIALIZATION_WARNING
|
||||
throw std::runtime_error("Cannot serialize a neural network unless "
|
||||
"MLPACK_ENABLE_ANN_SERIALIZATION is defined! See the \"Additional "
|
||||
"build options\" section of the README for more information.");
|
||||
#endif
|
||||
#else
|
||||
ar(CEREAL_NVP(bpttSteps));
|
||||
ar(CEREAL_NVP(single));
|
||||
ar(CEREAL_NVP(network));
|
||||
|
||||
if (Archive::is_loading::value)
|
||||
{
|
||||
// We can clear these members, since it's not possible to serialize in the
|
||||
// middle of training and resume.
|
||||
predictors.clear();
|
||||
responses.clear();
|
||||
}
|
||||
if (Archive::is_loading::value)
|
||||
{
|
||||
// We can clear these members, since it's not possible to serialize in the
|
||||
// middle of training and resume.
|
||||
predictors.clear();
|
||||
responses.clear();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<
|
||||
|
||||
@@ -221,7 +221,14 @@ else()
|
||||
target_compile_definitions(mlpack_test PUBLIC -DMLPACK_SUPPRESS_FATAL)
|
||||
endif()
|
||||
|
||||
set_target_properties(mlpack_test PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "../core.hpp")
|
||||
# This has to be added here so that cotire picks it up (even though it is in
|
||||
# individual tests).
|
||||
target_compile_definitions(mlpack_test PUBLIC -DMLPACK_ENABLE_ANN_SERIALIZATION)
|
||||
set_target_properties(mlpack_test PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT
|
||||
"../core.hpp")
|
||||
# TODO: use the source below, but this requires the DET test to be refactored
|
||||
# and cleaned up.
|
||||
# "../../mlpack.hpp")
|
||||
cotire(mlpack_test)
|
||||
|
||||
# Copy test data into right place.
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
* 3-clause BSD license along with mlpack. If not, see
|
||||
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
|
||||
*/
|
||||
#define MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#ifndef MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#define MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#endif
|
||||
#include <mlpack/core.hpp>
|
||||
#include <mlpack/methods/ann/ann.hpp>
|
||||
#include <mlpack/methods/kmeans/kmeans.hpp>
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
* 3-clause BSD license along with mlpack. If not, see
|
||||
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
|
||||
*/
|
||||
#define MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#ifndef MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#define MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#endif
|
||||
#include <mlpack/core.hpp>
|
||||
#include <mlpack/methods/ann.hpp>
|
||||
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
* @file tests/ann/layer/hard_tanh.cpp
|
||||
* @author Vaibhav Pathak
|
||||
*
|
||||
* Tests the hard_tanh layer
|
||||
* Tests the hard_tanh layer.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <mlpack/core.hpp>
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
* 3-clause BSD license along with mlpack. If not, see
|
||||
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
|
||||
*/
|
||||
#ifndef MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#define MLPACK_ENABLE_ANN_SERIALIZATION
|
||||
#endif
|
||||
#include <mlpack.hpp>
|
||||
|
||||
// #define CATCH_CONFIG_MAIN // catch.hpp will define main()
|
||||
|
||||
Reference in New Issue
Block a user