From a759382e5853696154dc48acc98c10dfab9d87fb Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Mon, 24 May 2021 17:55:08 +0200 Subject: [PATCH 01/98] Check for blas and Lapack before downloading armadillo Signed-off-by: Omar Shrit --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index daf416f5e2..e2bd365156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,6 +280,11 @@ if (DISABLE_DOWNLOADS) else() find_package(Armadillo "${ARMADILLO_VERSION}") if (NOT ARMADILLO_FOUND) + find_package(BLAS QUIET) + find_package(LAPACK QUIET) + if (NOT BLAS_FOUND AND NOT LAPACK_FOUND) + message(FATAL_ERROR "Can not find BLAS or LAPACK, please install one of them before installing mlpack") + endif() get_deps(http://files.mlpack.org/armadillo-10.3.0.tar.gz armadillo armadillo-10.3.0.tar.gz) set(ARMADILLO_INCLUDE_DIR ${GENERIC_INCLUDE_DIR}) find_package(Armadillo REQUIRED) From 32444d2336bf5dfc0f7c984385047ec904b83899 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Mon, 24 May 2021 18:18:21 +0200 Subject: [PATCH 02/98] Adding the missing installation step for the Autodownloader Signed-off-by: Omar Shrit --- CMake/Autodownload.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMake/Autodownload.cmake b/CMake/Autodownload.cmake index b82ab001b9..9339dcc9bf 100644 --- a/CMake/Autodownload.cmake +++ b/CMake/Autodownload.cmake @@ -45,9 +45,11 @@ macro(get_deps LINK DEPS_NAME PACKAGE) if (DIRECTORIES_LEN GREATER 0) list(GET DIRECTORIES 0 DEPENDENCY_DIR) set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include") - # Clean this line when boost is removed. + install(DIRECTORY "${GENERIC_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + # Clean these lines when boost is removed. if (${DEPS_NAME} MATCHES "boost") set(Boost_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/") + install(DIRECTORY "${Boost_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") endif() else () message(FATAL_ERROR From de040a0e70837e13ab628e920dce26ed43f27ce2 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Mon, 24 May 2021 18:20:29 +0200 Subject: [PATCH 03/98] Add missing period --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2bd365156..6445bf7847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,7 +283,7 @@ else() find_package(BLAS QUIET) find_package(LAPACK QUIET) if (NOT BLAS_FOUND AND NOT LAPACK_FOUND) - message(FATAL_ERROR "Can not find BLAS or LAPACK, please install one of them before installing mlpack") + message(FATAL_ERROR "Can not find BLAS or LAPACK, please install one of them before installing mlpack.") endif() get_deps(http://files.mlpack.org/armadillo-10.3.0.tar.gz armadillo armadillo-10.3.0.tar.gz) set(ARMADILLO_INCLUDE_DIR ${GENERIC_INCLUDE_DIR}) From acc845683048f5ea762b618c2ceb12a11cbad4f2 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Tue, 25 May 2021 14:53:20 +0200 Subject: [PATCH 04/98] Update CMakeLists.txt Co-authored-by: Ryan Curtin --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6445bf7847..1b6729d10b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,7 +283,7 @@ else() find_package(BLAS QUIET) find_package(LAPACK QUIET) if (NOT BLAS_FOUND AND NOT LAPACK_FOUND) - message(FATAL_ERROR "Can not find BLAS or LAPACK, please install one of them before installing mlpack.") + message(FATAL_ERROR "Can not find BLAS or LAPACK! These are required for Armadillo. Please install one of them---or install Armadillo---before installing mlpack.") endif() get_deps(http://files.mlpack.org/armadillo-10.3.0.tar.gz armadillo armadillo-10.3.0.tar.gz) set(ARMADILLO_INCLUDE_DIR ${GENERIC_INCLUDE_DIR}) From ac122a9ab73e9690faf4b9a696f725bead1e3836 Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Wed, 26 May 2021 13:49:48 +0530 Subject: [PATCH 05/98] improved speed of mean_backward under certain condition --- src/mlpack/methods/ann/layer/mean_pooling.hpp | 85 ++++++++++++++----- 1 file changed, 62 insertions(+), 23 deletions(-) diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index 80daaa9951..312388eab1 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -195,35 +195,74 @@ class MeanPooling arma::Mat& output) { - arma::Mat unpooledError; - for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, colidx++) + size_t condition = kernelHeight * kernelWidth - strideHeight * strideWidth - + kernelWidth - kernelHeight; + size_t kernalArea = kernelHeight * kernelWidth; + if (condition > 0) { - for (size_t i = 0, rowidx = 0; i < input.n_rows; i += strideWidth, rowidx++) - { - size_t rowEnd = i + kernelWidth - 1; - size_t colEnd = j + kernelHeight - 1; - - if (rowEnd > input.n_rows - 1) + for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, colidx++) + { + for (size_t i = 0, rowidx = 0; i < input.n_rows; i += strideWidth, rowidx++) { - if (floor) - continue; - rowEnd = input.n_rows - 1; + size_t rowEnd = i + kernelWidth - 1; + size_t colEnd = j + kernelHeight - 1; + + if (rowEnd >= input.n_rows || colEnd >= input.n_cols) + break; + + output(i, j) += error(rowidx, colidx) / kernalArea; + + if (rowEnd + 1 < input.n_rows) + { + output(rowEnd + 1, j) -= error(rowidx, colidx) / kernalArea; + + if (colEnd + 1 < input.n_cols) + output(rowEnd + 1, colEnd + 1) += error(rowidx, colidx) / kernalArea; + } } - if (colEnd > input.n_cols - 1) + if (colEnd + 1 < input.n_cols) + output(i, colEnd + 1) -= error(rowidx, colidx) / kernalArea; + } + + for (size_t i = 1; i < input.n_rows; ++i) + output.row(i) += output.row(i - 1); + + for (size_t j = 1; j < input.n_cols; ++j) + output.col(j) += output.col(j - 1); + } + else + { + arma::Mat unpooledError; + for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, colidx++) + { + for (size_t i = 0, rowidx = 0; i < input.n_rows; i += strideWidth, rowidx++) { - if (floor) - continue; - colEnd = input.n_cols - 1; + size_t rowEnd = i + kernelWidth - 1; + size_t colEnd = j + kernelHeight - 1; + + if (rowEnd > input.n_rows - 1) + { + if (floor) + continue; + rowEnd = input.n_rows - 1; + } + + if (colEnd > input.n_cols - 1) + { + if (floor) + continue; + colEnd = input.n_cols - 1; + } + + arma::mat InputArea = input(arma::span(i, rowEnd), arma::span(j, colEnd)); + + unpooledError = arma::Mat(InputArea.n_rows, InputArea.n_cols); + unpooledError.fill(error(rowidx, colidx) / InputArea.n_elem); + + output(arma::span(i, i + InputArea.n_rows - 1), + arma::span(j, j + InputArea.n_cols - 1)) += unpooledError; } - - arma::mat InputArea = input(arma::span(i, rowEnd), arma::span(j, colEnd)); - - unpooledError = arma::Mat(InputArea.n_rows, InputArea.n_cols); - unpooledError.fill(error(rowidx, colidx) / InputArea.n_elem); - - output(arma::span(i, i + InputArea.n_rows - 1), - arma::span(j, j + InputArea.n_cols - 1)) += unpooledError; } } } From b18199899b34ef5a5d76a986e9b9dfad26e5c193 Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Wed, 26 May 2021 14:21:31 +0530 Subject: [PATCH 06/98] minor fix --- src/mlpack/methods/ann/layer/mean_pooling.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index 312388eab1..bde20c3c6a 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -219,10 +219,10 @@ class MeanPooling if (colEnd + 1 < input.n_cols) output(rowEnd + 1, colEnd + 1) += error(rowidx, colidx) / kernalArea; } - } - if (colEnd + 1 < input.n_cols) - output(i, colEnd + 1) -= error(rowidx, colidx) / kernalArea; + if (colEnd + 1 < input.n_cols) + output(i, colEnd + 1) -= error(rowidx, colidx) / kernalArea; + } } for (size_t i = 1; i < input.n_rows; ++i) From 21744a71fd0bf9667baf7e697f0ae8ad71956645 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Wed, 26 May 2021 20:16:18 +0530 Subject: [PATCH 07/98] When ceil = true the kernal size will change. --- src/mlpack/methods/ann/layer/mean_pooling.hpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index bde20c3c6a..1df12e5bc5 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -197,7 +197,7 @@ class MeanPooling size_t condition = kernelHeight * kernelWidth - strideHeight * strideWidth - kernelWidth - kernelHeight; - size_t kernalArea = kernelHeight * kernelWidth; + if (condition > 0) { for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, colidx++) @@ -207,9 +207,21 @@ class MeanPooling size_t rowEnd = i + kernelWidth - 1; size_t colEnd = j + kernelHeight - 1; - if (rowEnd >= input.n_rows || colEnd >= input.n_cols) - break; + if (rowEnd > input.n_rows - 1) + { + if (floor) + continue; + rowEnd = input.n_rows - 1; + } + if (colEnd > input.n_cols - 1) + { + if (floor) + continue; + colEnd = input.n_cols - 1; + } + + size_t kernalArea = (rowEnd - i + 1) * (colEnd - j + 1); output(i, j) += error(rowidx, colidx) / kernalArea; if (rowEnd + 1 < input.n_rows) From caa4246531079f343e857b6f826bd87c0fe66de6 Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Thu, 27 May 2021 16:19:16 +0530 Subject: [PATCH 08/98] implemented channel shuffle --- src/mlpack/methods/ann/layer/CMakeLists.txt | 2 + .../methods/ann/layer/channel_shuffle.hpp | 140 ++++++++++++++++++ .../ann/layer/channel_shuffle_impl.hpp | 137 +++++++++++++++++ src/mlpack/methods/ann/layer/layer_types.hpp | 2 + src/mlpack/tests/ann_layer_test.cpp | 39 +++++ 5 files changed, 320 insertions(+) create mode 100644 src/mlpack/methods/ann/layer/channel_shuffle.hpp create mode 100644 src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp diff --git a/src/mlpack/methods/ann/layer/CMakeLists.txt b/src/mlpack/methods/ann/layer/CMakeLists.txt index 52dbebec75..d1eb91ff55 100644 --- a/src/mlpack/methods/ann/layer/CMakeLists.txt +++ b/src/mlpack/methods/ann/layer/CMakeLists.txt @@ -18,6 +18,8 @@ set(SOURCES batch_norm_impl.hpp bilinear_interpolation.hpp bilinear_interpolation_impl.hpp + channel_shuffle.hpp + channel_shuffle_impl.hpp concat.hpp concat_impl.hpp concat_performance.hpp diff --git a/src/mlpack/methods/ann/layer/channel_shuffle.hpp b/src/mlpack/methods/ann/layer/channel_shuffle.hpp new file mode 100644 index 0000000000..a9b3e2ec37 --- /dev/null +++ b/src/mlpack/methods/ann/layer/channel_shuffle.hpp @@ -0,0 +1,140 @@ +/** + * @file methods/ann/layer/channel_shuffle.hpp + * @author Abhinav Anand + * + * 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_METHODS_ANN_LAYER_CHANNEL_SHUFFLE_HPP +#define MLPACK_METHODS_ANN_LAYER_CHANNEL_SHUFFLE_HPP + +#include + +namespace mlpack { +namespace ann /** Artificial Neural Network. */ { + +/** + * Definition and Implementation of the Channel Shuffle Layer. + * + * Channel Shuffle divide the channels/units in a tensor into groups + * and rearrange while keeping the original tensor shape. + * + * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, + * arma::sp_mat or arma::cube). + * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, + * arma::sp_mat or arma::cube). + */ +template < + typename InputDataType = arma::mat, + typename OutputDataType = arma::mat +> +class ChannelShuffle +{ + public: + //! Create the Channel Shuffle object. + ChannelShuffle(); + + /** + * The constructor for the Channel Shuffle. + * + * @param depth Number of input slices. + * @param group Number of groups for shuffling channels. + */ + ChannelShuffle(const size_t inRowSize, + const size_t inColSize, + const size_t depth, + const size_t group); + + /** + * Forward pass through the layer. + * + * @param input The input matrix. + * @param output The resulting interpolated output matrix. + */ + template + void Forward(const arma::Mat& input, arma::Mat& output); + + /** + * Ordinary feed backward pass of a neural network, calculating the function + * f(x) by propagating x backwards through f. Using the results from the feed + * forward pass. Since the layer does not have any learn-able parameters, + * we just have to down-sample the gradient to make its size compatible with + * the input size. + * + * @param * (input) The input matrix. + * @param gradient The computed backward gradient. + * @param output The resulting down-sampled output. + */ + template + void Backward(const arma::Mat& /*input*/, + const arma::Mat& gradient, + arma::Mat& output); + + //! Get the output parameter. + OutputDataType const& OutputParameter() const { return outputParameter; } + //! Modify the output parameter. + OutputDataType& OutputParameter() { return outputParameter; } + + //! Get the delta. + OutputDataType const& Delta() const { return delta; } + //! Modify the delta. + OutputDataType& Delta() { return delta; } + + //! Get the row size of the input. + size_t const& InRowSize() const { return inRowSize; } + //! Modify the row size of the input. + size_t& InRowSize() { return inRowSize; } + + //! Get the column size of the input. + size_t const& InColSize() const { return inColSize; } + //! Modify the column size of the input. + size_t& InColSize() { return inColSize; } + + //! Get the depth of the input. + size_t const& InDepth() const { return depth; } + //! Modify the depth of the input. + size_t& InDepth() { return depth; } + + //! Get the number of groups the channels is divided into. + size_t const& InGroup() const { return group; } + //! Modify the number of groups the channels is divided into. + size_t& InGroup() { return group; } + + //! Get the shape of the input. + size_t InputShape() const + { + return inRowSize; + } + + /** + * Serialize the layer. + */ + template + void serialize(Archive& ar, const uint32_t /* version */); + + private: + //! Locally stored row size of the input. + size_t inRowSize; + //! Locally stored column size of the input. + size_t inColSize; + //! Locally stored depth of the input. + size_t depth; + //! Locally stored the number of groups the channels is divided into. + size_t group; + //! Locally stored number of input points. + size_t batchSize; + //! Locally-stored delta object. + OutputDataType delta; + //! Locally-stored output parameter object. + OutputDataType outputParameter; +}; // class ChannelShuffle + +} // namespace ann +} // namespace mlpack + +// Include implementation. +#include "channel_shuffle_impl.hpp" + +#endif diff --git a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp new file mode 100644 index 0000000000..96ee7eb76e --- /dev/null +++ b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp @@ -0,0 +1,137 @@ +/** + * @file methods/ann/layer/channe_shuffle_impl.hpp + * @author Abhinav Anand + * + * Implementation of the channel shuffle function as an individual 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. + */ +#ifndef MLPACK_METHODS_ANN_LAYER_CHANNEL_SHUFFLE_IMPL_HPP +#define MLPACK_METHODS_ANN_LAYER_CHANNEL_SHUFFLE_IMPL_HPP + +// In case it hasn't yet been included. +#include "channel_shuffle.hpp" + +namespace mlpack { +namespace ann /** Artificial Neural Network. */ { + + +template +ChannelShuffle:: +ChannelShuffle(): + inRowSize(0), + inColSize(0), + depth(0), + groupCount(0), + batchSize(0) +{ + // Nothing to do here. +} + +template +ChannelShuffle:: +ChannelShuffle( + const size_t inRowSize, + const size_t inColSize, + const size_t depth, + const size_t groupCount): + depth(depth), + groupCount(groupCount), + batchSize(0) +{ + if (depth % groupCount != 0) + { + Log::Fatal << "Number of channels must be divisible by groupCount.!" << std::endl; + } +} + +template +template +void ChannelShuffle::Forward( + const arma::Mat& input, arma::Mat& output) +{ + batchSize = input.n_cols; + cons + if (output.is_empty()) + output.set_size(inRowSize * inColSize * depth, batchSize); + else + { + assert(output.n_rows == inRowSize * inColSize * depth); + assert(output.n_cols == batchSize); + } + + + arma::cube inputAsCube(const_cast&>(input).memptr(), + inRowSize, inColSize, depth * batchSize, false, false); + arma::cube outputAsCube(output.memptr(), inRowSize, inColSize, + depth * batchSize, false, true); + + const size_t groupSize= depth / groupCount; + size_t outChannelIdx = 0; + for (int k = 0; k < batchSize; ++k) + { + for (int i = 0; i < groupSize; ++i) + { + for (int g = 0; g < groupCount; ++g, ++outChannelIdx) + { + size_t inChannelIdx = k * batchSize + g * groupSize + i; + outputAsCube.slice(outChannelIdx) = inputAsCube.slice(inChannelIdx); + } + } + } + +} + +template +template +void ChannelShuffle::Backward( + const arma::Mat& /*input*/, + const arma::Mat& gradient, + arma::Mat& output) +{ + if (output.is_empty()) + output.set_size(inRowSize * inColSize * depth, batchSize); + else + { + assert(output.n_rows == inRowSize * inColSize * depth); + assert(output.n_cols == batchSize); + } + + arma::cube gradientAsCube(((arma::Mat&) gradient).memptr(), inColSize, + inColSize, depth * batchSize, false, false); + arma::cube outputAsCube(output.memptr(), inRowSize, inColSize, + depth * batchSize, false, true); + + const size_t groupSize= depth / groupCount; + size_t outChannelIdx = 0; + for (int k = 0; k < batchSize; ++k) + { + for (int i = 0; i < groupSize; ++i) + { + for (int g = 0; g < groupCount; ++g, ++outChannelIdx) + { + size_t gradientChannelIdx = k * batchSize + g * groupSize + i; + outputAsCube.slice(outChannelIdx) = inputAsCube.slice(gradientChannelIdx); + } + } + } + +} + +template +template +void ChannelShuffle::serialize( + Archive& ar, const uint32_t /* version */) +{ + ar(CEREAL_NVP(inRowSize)); + ar(CEREAL_NVP(inColSize)); + ar(CEREAL_NVP(depth)); +} + +} // namespace ann +} // namespace mlpack + +#endif diff --git a/src/mlpack/methods/ann/layer/layer_types.hpp b/src/mlpack/methods/ann/layer/layer_types.hpp index 2532efecfe..dfcf7a0645 100644 --- a/src/mlpack/methods/ann/layer/layer_types.hpp +++ b/src/mlpack/methods/ann/layer/layer_types.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -224,6 +225,7 @@ using MoreTypes = boost::variant< Linear3D*, LpPooling*, PixelShuffle*, + Channel_Shuffle*, Glimpse*, Highway*, MultiheadAttention*, diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 13576eb11a..74c158dc0d 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -4656,6 +4656,45 @@ TEST_CASE("TransposedConvolutionWeightInitializationTest", "[ANNLayerTest]") == (outSize * inSize * kernelWidth * kernelHeight) + outSize); } +/** + * Simple Test for ChannelShuffle layer. + */ +TEST_CASE("ChannelShuffleLayerTest", "[ANNLayerTest]") +{ + arma::mat input1, output1, outputExpected1; + ChannelShuffle<> module1(2, 2, 6, 2); + + input1 << 1 << 2 << arma::endr + << 3 << 4 << arma::endr + << 5 << 6 << arma::endr + << 7 << 8 << arma::endr + << 9 << 10 << arma::endr + << 11 << 12 << arma::endr + << 13 << 14 << arma::endr + << 15 << 16 << arma::endr + << 17 << 18 << arma::endr + << 19 << 20 << arma::endr + << 21 << 22 << arma::endr + << 23 << 24 << arma::endr; + input1.reshape(24, 1); + outputExpected1 << 1 << 2 << arma::endr + << 3 << 4 << arma::endr + << 13 << 14 << arma::endr + << 15 << 16 << arma::endr + << 5 << 6 << arma::endr + << 7 << 8 << arma::endr + << 17 << 18 << arma::endr + << 19 << 20 << arma::endr + << 9 << 10 << arma::endr + << 11 << 12 << arma::endr + << 21 << 22 << arma::endr + << 23 << 24 << arma::endr; + // Check the Forward pass of the layer. + module1.Forward(input1, output1); + CheckMatrices(output1, outputExpected1); + +} + /** * Simple Test for PixelShuffle layer. */ From c37e16331e250d414751cf88587940c2bc76b47f Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Thu, 27 May 2021 16:28:24 +0530 Subject: [PATCH 09/98] fixed backwawrd function --- src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp index 96ee7eb76e..7ff3fbcb81 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp @@ -106,15 +106,15 @@ void ChannelShuffle::Backward( depth * batchSize, false, true); const size_t groupSize= depth / groupCount; - size_t outChannelIdx = 0; + size_t gradientChannelIdx = 0; for (int k = 0; k < batchSize; ++k) { for (int i = 0; i < groupSize; ++i) { - for (int g = 0; g < groupCount; ++g, ++outChannelIdx) + for (int g = 0; g < groupCount; ++g, ++gradientChannelIdx) { - size_t gradientChannelIdx = k * batchSize + g * groupSize + i; - outputAsCube.slice(outChannelIdx) = inputAsCube.slice(gradientChannelIdx); + size_t outChannelIdx = k * batchSize + g * groupSize + i; + outputAsCube.slice(outChannelIdx) = gradientAsCube.slice(gradientChannelIdx); } } } From 181f1807283a60392ccab2171155e90670d7c2a9 Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Thu, 27 May 2021 17:33:23 +0530 Subject: [PATCH 10/98] minor fix --- src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp | 4 +++- src/mlpack/methods/ann/layer/layer_types.hpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp index 7ff3fbcb81..32c9001b15 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp @@ -38,6 +38,8 @@ ChannelShuffle( const size_t inColSize, const size_t depth, const size_t groupCount): + inRowSize(inRowSize), + inColSize(inColSize), depth(depth), groupCount(groupCount), batchSize(0) @@ -54,7 +56,7 @@ void ChannelShuffle::Forward( const arma::Mat& input, arma::Mat& output) { batchSize = input.n_cols; - cons + if (output.is_empty()) output.set_size(inRowSize * inColSize * depth, batchSize); else diff --git a/src/mlpack/methods/ann/layer/layer_types.hpp b/src/mlpack/methods/ann/layer/layer_types.hpp index dfcf7a0645..d72cd1fa33 100644 --- a/src/mlpack/methods/ann/layer/layer_types.hpp +++ b/src/mlpack/methods/ann/layer/layer_types.hpp @@ -225,7 +225,7 @@ using MoreTypes = boost::variant< Linear3D*, LpPooling*, PixelShuffle*, - Channel_Shuffle*, + ChannelShuffle*, Glimpse*, Highway*, MultiheadAttention*, From 210c1dc7d96fde8361c20b28fcbe78c7bcb533dc Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Thu, 27 May 2021 18:11:05 +0530 Subject: [PATCH 11/98] minor fix --- src/mlpack/methods/ann/layer/channel_shuffle.hpp | 10 ++++++---- .../methods/ann/layer/channel_shuffle_impl.hpp | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle.hpp b/src/mlpack/methods/ann/layer/channel_shuffle.hpp index a9b3e2ec37..dca7f45a1f 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle.hpp @@ -39,13 +39,15 @@ class ChannelShuffle /** * The constructor for the Channel Shuffle. * + * @param inRowSize Number of input rows. + * @param inColSize Number of input columns. * @param depth Number of input slices. * @param group Number of groups for shuffling channels. */ ChannelShuffle(const size_t inRowSize, const size_t inColSize, const size_t depth, - const size_t group); + const size_t groupCount); /** * Forward pass through the layer. @@ -98,9 +100,9 @@ class ChannelShuffle size_t& InDepth() { return depth; } //! Get the number of groups the channels is divided into. - size_t const& InGroup() const { return group; } + size_t const& InGroupCount() const { return groupCount; } //! Modify the number of groups the channels is divided into. - size_t& InGroup() { return group; } + size_t& InGroupCount() { return groupCount; } //! Get the shape of the input. size_t InputShape() const @@ -122,7 +124,7 @@ class ChannelShuffle //! Locally stored depth of the input. size_t depth; //! Locally stored the number of groups the channels is divided into. - size_t group; + size_t groupCount; //! Locally stored number of input points. size_t batchSize; //! Locally-stored delta object. diff --git a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp index 32c9001b15..5a4c2886ed 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp @@ -73,11 +73,11 @@ void ChannelShuffle::Forward( const size_t groupSize= depth / groupCount; size_t outChannelIdx = 0; - for (int k = 0; k < batchSize; ++k) + for (size_t k = 0; k < batchSize; ++k) { - for (int i = 0; i < groupSize; ++i) + for (size_t i = 0; i < groupSize; ++i) { - for (int g = 0; g < groupCount; ++g, ++outChannelIdx) + for (size_t g = 0; g < groupCount; ++g, ++outChannelIdx) { size_t inChannelIdx = k * batchSize + g * groupSize + i; outputAsCube.slice(outChannelIdx) = inputAsCube.slice(inChannelIdx); @@ -109,11 +109,11 @@ void ChannelShuffle::Backward( const size_t groupSize= depth / groupCount; size_t gradientChannelIdx = 0; - for (int k = 0; k < batchSize; ++k) + for (size_t k = 0; k < batchSize; ++k) { - for (int i = 0; i < groupSize; ++i) + for (size_t i = 0; i < groupSize; ++i) { - for (int g = 0; g < groupCount; ++g, ++gradientChannelIdx) + for (size_t g = 0; g < groupCount; ++g, ++gradientChannelIdx) { size_t outChannelIdx = k * batchSize + g * groupSize + i; outputAsCube.slice(outChannelIdx) = gradientAsCube.slice(gradientChannelIdx); From 5ceb8daf1611b94f47a809ce8626d42e28cb01a8 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Thu, 27 May 2021 16:15:06 +0200 Subject: [PATCH 12/98] Check of the deps name is not equal boost Signed-off-by: Omar Shrit --- CMake/Autodownload.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMake/Autodownload.cmake b/CMake/Autodownload.cmake index 9339dcc9bf..ce23e32909 100644 --- a/CMake/Autodownload.cmake +++ b/CMake/Autodownload.cmake @@ -44,12 +44,13 @@ macro(get_deps LINK DEPS_NAME PACKAGE) list(LENGTH DIRECTORIES DIRECTORIES_LEN) if (DIRECTORIES_LEN GREATER 0) list(GET DIRECTORIES 0 DEPENDENCY_DIR) - set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include") - install(DIRECTORY "${GENERIC_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") # Clean these lines when boost is removed. if (${DEPS_NAME} MATCHES "boost") set(Boost_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/") install(DIRECTORY "${Boost_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + else() + set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include") + install(DIRECTORY "${GENERIC_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") endif() else () message(FATAL_ERROR From d2114617ae6bfd0b066c3673eb848eacf2f14ff6 Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Thu, 27 May 2021 21:06:03 +0530 Subject: [PATCH 13/98] fixed test case --- src/mlpack/tests/ann_layer_test.cpp | 54 ++++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 74c158dc0d..3a444947e8 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -4661,38 +4661,42 @@ TEST_CASE("TransposedConvolutionWeightInitializationTest", "[ANNLayerTest]") */ TEST_CASE("ChannelShuffleLayerTest", "[ANNLayerTest]") { - arma::mat input1, output1, outputExpected1; + arma::mat input1, output1, outputExpected1, outputBackward1; ChannelShuffle<> module1(2, 2, 6, 2); - input1 << 1 << 2 << arma::endr - << 3 << 4 << arma::endr - << 5 << 6 << arma::endr - << 7 << 8 << arma::endr - << 9 << 10 << arma::endr - << 11 << 12 << arma::endr - << 13 << 14 << arma::endr - << 15 << 16 << arma::endr - << 17 << 18 << arma::endr - << 19 << 20 << arma::endr - << 21 << 22 << arma::endr - << 23 << 24 << arma::endr; + input1 << 1 << 13 << arma::endr + << 2 << 14 << arma::endr + << 3 << 15 << arma::endr + << 4 << 16 << arma::endr + << 5 << 17 << arma::endr + << 6 << 18 << arma::endr + << 7 << 19 << arma::endr + << 8 << 20 << arma::endr + << 9 << 21 << arma::endr + << 10 << 22 << arma::endr + << 11 << 23 << arma::endr + << 12 << 24 << arma::endr; input1.reshape(24, 1); - outputExpected1 << 1 << 2 << arma::endr - << 3 << 4 << arma::endr - << 13 << 14 << arma::endr - << 15 << 16 << arma::endr - << 5 << 6 << arma::endr - << 7 << 8 << arma::endr - << 17 << 18 << arma::endr - << 19 << 20 << arma::endr - << 9 << 10 << arma::endr - << 11 << 12 << arma::endr - << 21 << 22 << arma::endr - << 23 << 24 << arma::endr; + outputExpected1 << 1 << 17 << arma::endr + << 2 << 18 << arma::endr + << 3 << 19 << arma::endr + << 4 << 20 << arma::endr + << 13 << 9 << arma::endr + << 14 << 10 << arma::endr + << 15 << 11 << arma::endr + << 16 << 12 << arma::endr + << 5 << 21 << arma::endr + << 6 << 22 << arma::endr + << 7 << 23 << arma::endr + << 8 << 24 << arma::endr; // Check the Forward pass of the layer. module1.Forward(input1, output1); CheckMatrices(output1, outputExpected1); + // Check the Backward pass of the layer. + module1.backward(output1, output1, outputBackward1); + CheckMatrices(input1, outputBackward1); + } /** From 5c1600c112785d85091a110ffa8f8594c680faeb Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Thu, 27 May 2021 21:42:04 +0530 Subject: [PATCH 14/98] fixed test case --- src/mlpack/tests/ann_layer_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 3a444947e8..2bc3eff890 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -4694,7 +4694,7 @@ TEST_CASE("ChannelShuffleLayerTest", "[ANNLayerTest]") CheckMatrices(output1, outputExpected1); // Check the Backward pass of the layer. - module1.backward(output1, output1, outputBackward1); + module1.Backward(output1, output1, outputBackward1); CheckMatrices(input1, outputBackward1); } From d8d6de550bbbe7647a29e3186fb9a8c8bbbbabe4 Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Thu, 27 May 2021 22:48:07 +0530 Subject: [PATCH 15/98] fixed test case --- src/mlpack/tests/ann_layer_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 2bc3eff890..63c82f3b4a 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -4693,6 +4693,7 @@ TEST_CASE("ChannelShuffleLayerTest", "[ANNLayerTest]") module1.Forward(input1, output1); CheckMatrices(output1, outputExpected1); + outputExpected1.reshape(24, 1); // Check the Backward pass of the layer. module1.Backward(output1, output1, outputBackward1); CheckMatrices(input1, outputBackward1); From 86123a1e751d516e9b9c2d8a46af406df7e586be Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Fri, 28 May 2021 00:04:25 +0530 Subject: [PATCH 16/98] Fix test case --- src/mlpack/tests/ann_layer_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 63c82f3b4a..a8d7c4605a 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -4689,11 +4689,11 @@ TEST_CASE("ChannelShuffleLayerTest", "[ANNLayerTest]") << 6 << 22 << arma::endr << 7 << 23 << arma::endr << 8 << 24 << arma::endr; + outputExpected1.reshape(24, 1); // Check the Forward pass of the layer. module1.Forward(input1, output1); CheckMatrices(output1, outputExpected1); - outputExpected1.reshape(24, 1); // Check the Backward pass of the layer. module1.Backward(output1, output1, outputBackward1); CheckMatrices(input1, outputBackward1); From d3952325128ef892c91c2bfd525993346dc63387 Mon Sep 17 00:00:00 2001 From: Abhinav Anand Date: Fri, 28 May 2021 08:37:47 +0530 Subject: [PATCH 17/98] Added comments to explain the method and minor style fix --- src/mlpack/methods/ann/layer/mean_pooling.hpp | 55 +++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index 1df12e5bc5..57c00b3f35 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -195,15 +195,60 @@ class MeanPooling arma::Mat& output) { - size_t condition = kernelHeight * kernelWidth - strideHeight * strideWidth - + const size_t condition = kernelHeight * kernelWidth - strideHeight * strideWidth - kernelWidth - kernelHeight; if (condition > 0) { - for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, colidx++) + // If this condition is true then theoritically the prefix sum method of + // unpooling is faster. The aim of unpooling is to add + // `error(i, j) / kernalArea` to `inputArea(kernal)`. This requires + // inputArea.n_elem additions. So, total operations required will be + // `error.n_elem * inputArea.n_elem` operations. + // To improve this method we will use an idea of prefix sums. Let's see + // this method in 1-D matrix then we will extend it to 2-D matrix. + // Let the input be a 1-D matrix input = `[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]` of size 10 + // and we want to add `10` to idx = 1 to idx = 5. In brute force method we can run + // a loop from idx = 1 to idx = 5 and add `10` to each element. In prefix method + // We will add `+10` to idx = 1 and `-10` to idx = (5 + 1). Now the input will look + // like `[0, +10, 0, 0, 0, 0, -10, 0, 0, 0]`. After that we can just do prefix + // sum `input[i] += input[i - 1]`. Then the input becomes + // `[0, +10, +10, +10, +10, +10, 0, 0, 0, 0]`. So the total computation require + // by this method is (2 additions + Prefix operations). + // Note that if there are `k` such operation of adding a number of some + // continuous subarray. Then the brute force method will require + // `k * size(subarray)` operations. But the prefix method will require + // `2 * k + Prefix` operations, because the Prefix can be performed once at + // the end. + // Now for 2-D matrix. Lets say we want to add `e` to all elements from + // input(x1 : x2, y1 : y2). So the inputArea = (x2 - x1 + 1) * (y2 - y1 + 1). + // In prefix method the following operations will be performed: + // 1. Add `+e` to input(x1, y1). + // 2. Add `-e` to input(x1 + 1, y1). + // 3. Add `-e` to input(x1, y1 + 1). + // 4. Add `+e` to input(x1 + 1, y1 + 1). + // 5. Perform Prefix sum over columns i.e input(i, j) += input(i, j - 1) + // 6. Perform Prefix sum over rows i.e input(i, j) += input(i - 1, j) + // So lets say if we had `k` number of such operations. The brute force + // method will require `kernalArea * k` operations. + // The prefix method will require `4 * k + Prefix operation`. + + for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, ++colidx) { - for (size_t i = 0, rowidx = 0; i < input.n_rows; i += strideWidth, rowidx++) + for (size_t i = 0, rowidx = 0; i < input.n_rows; i += strideWidth, ++rowidx) { + // We have to add error(i, j) to output(span(rowidx, rowEnd), span(colidx, colEnd)). + // The steps of prefix sum method: + // + // 1. For each (i, j) perform: + // 1.1 Add +error(i, j) to output(rowidx, colidx) + // 1.2 Add -error(i, j) to output(rowidx, colidx + 1) + // 1.3 Add -error(i, j) to output(rowidx + 1, colidx) + // 1.4 Add +error(i, j) to output(rowidx + 1, colidx + 1) + // + // 2. Do prefix sum column wise i.e output(i, j) += output(i, j - 1) + // 2. Do prefix sum row wise i.e output(i, j) += output(i - 1, j) + size_t rowEnd = i + kernelWidth - 1; size_t colEnd = j + kernelHeight - 1; @@ -246,9 +291,9 @@ class MeanPooling else { arma::Mat unpooledError; - for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, colidx++) + for (size_t j = 0, colidx = 0; j < input.n_cols; j += strideHeight, ++colidx) { - for (size_t i = 0, rowidx = 0; i < input.n_rows; i += strideWidth, rowidx++) + for (size_t i = 0, rowidx = 0; i < input.n_rows; i += strideWidth, ++rowidx) { size_t rowEnd = i + kernelWidth - 1; size_t colEnd = j + kernelHeight - 1; From ae4104b0d85409da6eeb7bf4234d793688dc20a2 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Tue, 1 Jun 2021 20:14:42 +0530 Subject: [PATCH 18/98] Apply suggestions from code review Co-authored-by: Marcus Edel --- src/mlpack/methods/ann/layer/channel_shuffle.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle.hpp b/src/mlpack/methods/ann/layer/channel_shuffle.hpp index dca7f45a1f..27c747e84a 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle.hpp @@ -16,9 +16,9 @@ namespace mlpack { namespace ann /** Artificial Neural Network. */ { /** - * Definition and Implementation of the Channel Shuffle Layer. + * Definition and implementation of the Channel Shuffle Layer. * - * Channel Shuffle divide the channels/units in a tensor into groups + * Channel Shuffle divides the channels/units in a tensor into groups * and rearrange while keeping the original tensor shape. * * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, From d063002f1f3c56998803052b4b51f7a345d9944c Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Sun, 6 Jun 2021 15:41:52 +0530 Subject: [PATCH 19/98] Got a better condition expression and gave its explanation --- src/mlpack/methods/ann/layer/mean_pooling.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index a5e97c9585..3d7b0716b4 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -210,10 +210,18 @@ class MeanPooling const arma::Mat& error, arma::Mat& output) { - const size_t condition = kernelHeight * kernelWidth - strideHeight * strideWidth - - kernelWidth - kernelHeight; + // This condition comes by comparing the number of operations involved in the brute + // force method and the prefix method. Let the area of error be errorArea and area + // of kernal be kernalArea. Total number of operations in brute force method will be + // `errorArea * kernalArea` and for each element in error we are doing kernalArea + // number of operations. Whereas in the prefix method the total number of operations + // will be `4 * errorArea + 2 * inputArea`. The term `2 * inputArea` comes from + // prefix sums performed (col-wise and row-wise). + // We can use this to determine which method to use. + const bool condition = (error.n_elem * kernalHeight * kernalWidth) > + (4 * error.n_elem + 2 * input.n_elem); - if (condition > 0) + if (condition) { // If this condition is true then theoritically the prefix sum method of // unpooling is faster. The aim of unpooling is to add From 01cb4b92b755fa881f3f4acfaf090c0870b7b14b Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Sun, 6 Jun 2021 20:28:33 +0530 Subject: [PATCH 20/98] typo fix. --- src/mlpack/methods/ann/layer/mean_pooling.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index 3d7b0716b4..ef0150653f 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -218,7 +218,7 @@ class MeanPooling // will be `4 * errorArea + 2 * inputArea`. The term `2 * inputArea` comes from // prefix sums performed (col-wise and row-wise). // We can use this to determine which method to use. - const bool condition = (error.n_elem * kernalHeight * kernalWidth) > + const bool condition = (error.n_elem * kernelHeight * kernelWidth) > (4 * error.n_elem + 2 * input.n_elem); if (condition) From c0d5fef5472ff72a9ac8a174f27a712d9e328d97 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Mon, 7 Jun 2021 09:25:58 +0530 Subject: [PATCH 21/98] Apply suggestions from code review Co-authored-by: Marcus Edel --- src/mlpack/methods/ann/layer/mean_pooling.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index ef0150653f..7789247018 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -213,7 +213,7 @@ class MeanPooling // This condition comes by comparing the number of operations involved in the brute // force method and the prefix method. Let the area of error be errorArea and area // of kernal be kernalArea. Total number of operations in brute force method will be - // `errorArea * kernalArea` and for each element in error we are doing kernalArea + // `errorArea * kernalArea` and for each element in error we are doing `kernalArea` // number of operations. Whereas in the prefix method the total number of operations // will be `4 * errorArea + 2 * inputArea`. The term `2 * inputArea` comes from // prefix sums performed (col-wise and row-wise). @@ -226,7 +226,7 @@ class MeanPooling // If this condition is true then theoritically the prefix sum method of // unpooling is faster. The aim of unpooling is to add // `error(i, j) / kernalArea` to `inputArea(kernal)`. This requires - // inputArea.n_elem additions. So, total operations required will be + // `inputArea.n_elem` additions. So, total operations required will be // `error.n_elem * inputArea.n_elem` operations. // To improve this method we will use an idea of prefix sums. Let's see // this method in 1-D matrix then we will extend it to 2-D matrix. From 82fc7550cd92a1de88fdfa5e7409b6934bee8ae1 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 7 Jun 2021 13:07:50 -0400 Subject: [PATCH 22/98] Make sure that the length of the model is serialized too. --- .../bindings/julia/print_param_defn.hpp | 10 ++++++--- src/mlpack/bindings/julia/tests/runtests.jl | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/mlpack/bindings/julia/print_param_defn.hpp b/src/mlpack/bindings/julia/print_param_defn.hpp index 1ee6d7d164..6e5d152770 100644 --- a/src/mlpack/bindings/julia/print_param_defn.hpp +++ b/src/mlpack/bindings/julia/print_param_defn.hpp @@ -79,12 +79,14 @@ void PrintParamDefn( // buffer = ccall((:SerializePtr, Library), // Vector{UInt8}, (Ptr{Nothing}, Ptr{UInt8}), model.ptr, // Base.pointer(buf_len)) - // buf = Base.unsafe_wrap(buf_ptr, buf_len[0]; own=true) + // buf = Base.unsafe_wrap(buf_ptr, buf_len[1]; own=true) + // write(stream, buf_len[1]) // write(stream, buf) // end // // function deserialize(stream::IO):: - // buffer = read(stream) + // buf_len = read(stream, UInt) + // buffer = read(stream, buf_len) // (ccall((:DeserializePtr, Library), // Ptr{Nothing}, (Vector{UInt8}, UInt), buffer, length(buffer))) // end @@ -138,6 +140,7 @@ void PrintParamDefn( << "Base.pointer(buf_len))" << std::endl; std::cout << " buf = Base.unsafe_wrap(Vector{UInt8}, buf_ptr, buf_len[1]; " << "own=true)" << std::endl; + std::cout << " write(stream, buf_len[1])" << std::endl; std::cout << " write(stream, buf)" << std::endl; std::cout << "end" << std::endl; @@ -145,7 +148,8 @@ void PrintParamDefn( std::cout << "# Deserialize a model from the given stream." << std::endl; std::cout << "function deserialize" << type << "(stream::IO)::" << type << std::endl; - std::cout << " buffer = read(stream)" << std::endl; + std::cout << " buf_len = read(stream, UInt)" << std::endl; + std::cout << " buffer = read(stream, buf_len)" << std::endl; std::cout << " " << type << "(ccall((:Deserialize" << type << "Ptr, " << programName << "Library), Ptr{Nothing}, (Ptr{UInt8}, UInt), " << "Base.pointer(buffer), length(buffer)))" << std::endl; diff --git a/src/mlpack/bindings/julia/tests/runtests.jl b/src/mlpack/bindings/julia/tests/runtests.jl index bb98c54435..57a6f548e0 100644 --- a/src/mlpack/bindings/julia/tests/runtests.jl +++ b/src/mlpack/bindings/julia/tests/runtests.jl @@ -342,6 +342,27 @@ end model_in=newModel) end +# Test that we can serialize a model as part of a larger tuple. +@testset "TestStreamTupleSerialization" begin + _, _, _, _, _, _, modelOut, _, _, _, _, _, _, _ = + test_julia_binding(4.0, 12, "hello", + build_model=true) + + stream = IOBuffer() + serialize(stream, (modelOut, 3, 4, 5)) + + newStream = IOBuffer(copy(stream.data)) + (newModel, a, b, c) = deserialize(newStream) + + _, _, _, _, _, bwOut, _, _, _, _, _, _, _, _ = + test_julia_binding(4.0, 12, "hello", + model_in=newModel) + + @test a == 3 + @test b == 4 + @test c == 5 +end + @testset "TestFileSerialization" begin _, _, _, _, _, _, modelOut, _, _, _, _, _, _, _ = test_julia_binding(4.0, 12, "hello", From d0e8351126ae1ba9d0a40991ba206f7dea5870c9 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 7 Jun 2021 13:13:04 -0400 Subject: [PATCH 23/98] Update history. --- HISTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index b08af6106e..d048cbdae1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -59,6 +59,8 @@ * Fixes to `HoeffdingTree`: ensure that training still works when empty constructor is used (#2964). + * Fix Julia model serialization bug (#2970). + ### mlpack 3.4.2 ###### 2020-10-26 * Added Mean Absolute Percentage Error. From 3a35be6d83b8c8ebb29d3928c3f0d0c32262aa40 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 7 Jun 2021 18:56:07 -0400 Subject: [PATCH 24/98] Maybe disable the cache? --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a9a2574072..96f285ccb9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds')" - name: Cache R packages - if: runner.os != 'Windows' + if: runner.os != 'Windows' && runner.os != 'macOS' uses: actions/cache@v1 with: path: ${{ env.R_LIBS_USER }} From b2581bdd653575ba4b6c7d7d62972ed24c0e54ce Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 7 Jun 2021 22:09:50 -0400 Subject: [PATCH 25/98] Just disable the cache entirely because I failed to do it right last try... --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 96f285ccb9..4d3ab17447 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,13 +40,13 @@ jobs: cp src/mlpack/bindings/R/mlpack/DESCRIPTION.in DESCRIPTION Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds')" - - name: Cache R packages - if: runner.os != 'Windows' && runner.os != 'macOS' - uses: actions/cache@v1 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-release-${{ hashFiles('depends.Rds') }} - restore-keys: ${{ runner.os }}-r-release- +# - name: Cache R packages +# if: runner.os != 'Windows' && runner.os != 'macOS' +# uses: actions/cache@v1 +# with: +# path: ${{ env.R_LIBS_USER }} +# key: ${{ runner.os }}-r-release-${{ hashFiles('depends.Rds') }} +# restore-keys: ${{ runner.os }}-r-release- - name: Install Build Dependencies run: | From a51db0bce302bd532cd92bfab14239cbf8f7134e Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 8 Jun 2021 10:18:18 -0400 Subject: [PATCH 26/98] I wonder if this will do anything? --- .github/workflows/main.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d3ab17447..c2bac7f193 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,13 +40,13 @@ jobs: cp src/mlpack/bindings/R/mlpack/DESCRIPTION.in DESCRIPTION Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds')" -# - name: Cache R packages -# if: runner.os != 'Windows' && runner.os != 'macOS' -# uses: actions/cache@v1 -# with: -# path: ${{ env.R_LIBS_USER }} -# key: ${{ runner.os }}-r-release-${{ hashFiles('depends.Rds') }} -# restore-keys: ${{ runner.os }}-r-release- + - name: Cache R packages + if: runner.os != 'Windows' + uses: actions/cache@v1 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-r-release-${{ hashFiles('depends.Rds') }} + restore-keys: ${{ runner.os }}-r-release- - name: Install Build Dependencies run: | @@ -59,6 +59,7 @@ jobs: run: | remotes::install_deps(dependencies = TRUE) remotes::install_cran("roxygen2") + remotes::install_cran("processx") shell: Rscript {0} - name: CMake From e9467cee01aca484ca75a1c166f0436164f11d60 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 8 Jun 2021 19:56:21 -0400 Subject: [PATCH 27/98] Some more attempts to get more output. --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2bac7f193..aa76d54489 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: - name: Query dependencies run: | cp src/mlpack/bindings/R/mlpack/DESCRIPTION.in DESCRIPTION - Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds')" + Rscript --verbose -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds')" - name: Cache R packages if: runner.os != 'Windows' @@ -132,10 +132,11 @@ jobs: run: | remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) remotes::install_cran("rcmdcheck") + remotes::install_cran("processx") shell: Rscript {0} - name: Check - run: Rscript -e "rcmdcheck::rcmdcheck('${{ needs.jobR.outputs.r_bindings }}', args = c('--no-manual','--as-cran'), error_on = 'warning', check_dir = 'check')" + run: Rscript --verbose -e "rcmdcheck::rcmdcheck('${{ needs.jobR.outputs.r_bindings }}', args = c('--no-manual','--as-cran'), error_on = 'warning', check_dir = 'check')" - name: Upload check results if: failure() From 7957eac1b8c10f6c4202f05bf0e6bf4390e4a6f8 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 9 Jun 2021 17:48:21 -0400 Subject: [PATCH 28/98] I wonder if this will fix the issue? --- src/mlpack/methods/ann/gan/metrics/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/gan/metrics/CMakeLists.txt b/src/mlpack/methods/ann/gan/metrics/CMakeLists.txt index c93ed9d492..0600b603fa 100644 --- a/src/mlpack/methods/ann/gan/metrics/CMakeLists.txt +++ b/src/mlpack/methods/ann/gan/metrics/CMakeLists.txt @@ -1,8 +1,8 @@ # Define the files we need to compile. # Anything not in this list will not be compiled into mlpack. set(SOURCES - inception_score - inception_score_impl + inception_score.hpp + inception_score_impl.hpp ) # Add directory name to sources. From 1325745fecb2d4e84ba7468be25143c23787cd02 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Thu, 10 Jun 2021 17:11:24 +0200 Subject: [PATCH 29/98] Try to fix the installation dir, do not push Signed-off-by: Omar Shrit --- CMake/Autodownload.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/Autodownload.cmake b/CMake/Autodownload.cmake index ce23e32909..9d93704801 100644 --- a/CMake/Autodownload.cmake +++ b/CMake/Autodownload.cmake @@ -47,7 +47,7 @@ macro(get_deps LINK DEPS_NAME PACKAGE) # Clean these lines when boost is removed. if (${DEPS_NAME} MATCHES "boost") set(Boost_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/") - install(DIRECTORY "${Boost_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + install(DIRECTORY "${Boost_INCLUDE_DIR}/boost" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") else() set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include") install(DIRECTORY "${GENERIC_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") From 8d67c9dad47085ad117f056bc648bb9e8fd5ddb2 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Thu, 10 Jun 2021 11:41:48 -0400 Subject: [PATCH 30/98] Safer unpacking of Armadillo sources. --- .ci/linux-steps.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.ci/linux-steps.yaml b/.ci/linux-steps.yaml index cab07dc8bb..228c404583 100644 --- a/.ci/linux-steps.yaml +++ b/.ci/linux-steps.yaml @@ -35,8 +35,12 @@ steps: fi # Install armadillo. - curl https://data.kurg.org/armadillo-8.400.0.tar.xz | tar -xvJ && cd armadillo* - cmake . && make && sudo make install && cd .. + curl https://data.kurg.org/armadillo-8.400.0.tar.xz | tar -xvJ && \ + cd armadillo* && \ + cmake . && \ + make && \ + sudo make install && \ + cd .. # Install cereal. wget https://github.com/USCiLab/cereal/archive/v1.3.0.tar.gz From 220fc370b1d81bbe5d115309893ae0b9d9580778 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 11 Jun 2021 14:54:49 -0400 Subject: [PATCH 31/98] What if we force reinstallation? --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aa76d54489..4b3f6da009 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: run: | remotes::install_deps(dependencies = TRUE) remotes::install_cran("roxygen2") - remotes::install_cran("processx") + remotes::install_cran("processx", force = TRUE) shell: Rscript {0} - name: CMake From 10cd2157692ef57d16b20060b6d1d446134eb9f4 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 11 Jun 2021 17:08:11 -0400 Subject: [PATCH 32/98] Oops, I forced in the wrong place. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4b3f6da009..d21ca98d10 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -132,7 +132,7 @@ jobs: run: | remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) remotes::install_cran("rcmdcheck") - remotes::install_cran("processx") + remotes::install_cran("processx", force=TRUE) shell: Rscript {0} - name: Check From c4ab2c8dac63702234582bef2c6e2aa3fa82ff7a Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 11 Jun 2021 20:11:20 -0400 Subject: [PATCH 33/98] Maybe reinstalling the ps package will help. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d21ca98d10..92fd4a037f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -132,6 +132,7 @@ jobs: run: | remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) remotes::install_cran("rcmdcheck") + remotes::install_cran("ps", force=TRUE) remotes::install_cran("processx", force=TRUE) shell: Rscript {0} From 11e387881b5b7d257bfdedd5a1f9834b1bbace42 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sat, 12 Jun 2021 08:30:02 -0400 Subject: [PATCH 34/98] Well it seems like maybe this strategy is working. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 92fd4a037f..6ca32904e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -132,6 +132,7 @@ jobs: run: | remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) remotes::install_cran("rcmdcheck") + remotes::install_cran("digest", force=TRUE) remotes::install_cran("ps", force=TRUE) remotes::install_cran("processx", force=TRUE) shell: Rscript {0} From 303b3100b6155587c97c5cfc0bebbf61ef97d8a7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 13 Jun 2021 08:36:20 -0400 Subject: [PATCH 35/98] Actually I think I am getting close now... --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6ca32904e6..d74b979875 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -135,6 +135,7 @@ jobs: remotes::install_cran("digest", force=TRUE) remotes::install_cran("ps", force=TRUE) remotes::install_cran("processx", force=TRUE) + remotes::install_cran("Rcpp", force=TRUE) shell: Rscript {0} - name: Check From d3c7522f2ca0387951de3827d7687f4be3fd1d7e Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 13 Jun 2021 11:07:25 -0400 Subject: [PATCH 36/98] Another package to reinstall... --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d74b979875..cc888925b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -136,6 +136,7 @@ jobs: remotes::install_cran("ps", force=TRUE) remotes::install_cran("processx", force=TRUE) remotes::install_cran("Rcpp", force=TRUE) + remotes::install_cran("testthat", force=TRUE) shell: Rscript {0} - name: Check From 0c6418b5cc88075f2a9276340a48030ebc477153 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 13 Jun 2021 13:14:20 -0400 Subject: [PATCH 37/98] Not sure about this one... --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cc888925b4..352df21a31 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -136,6 +136,7 @@ jobs: remotes::install_cran("ps", force=TRUE) remotes::install_cran("processx", force=TRUE) remotes::install_cran("Rcpp", force=TRUE) + remotes::install_cran("rlang", force=TRUE) remotes::install_cran("testthat", force=TRUE) shell: Rscript {0} From ca188e2d4fcc1bee3897dab7737d9cac00bda489 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Sun, 13 Jun 2021 19:05:08 -0400 Subject: [PATCH 38/98] Okay, another package... --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 352df21a31..5f347a4082 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -137,6 +137,7 @@ jobs: remotes::install_cran("processx", force=TRUE) remotes::install_cran("Rcpp", force=TRUE) remotes::install_cran("rlang", force=TRUE) + remotes::install_cran("magrittr", force=TRUE) remotes::install_cran("testthat", force=TRUE) shell: Rscript {0} From 62f7db4f2632fa42f55d920c0f8fbe6702f0cde4 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 14 Jun 2021 08:04:44 -0400 Subject: [PATCH 39/98] Another package... --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f347a4082..e43652b442 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -139,6 +139,7 @@ jobs: remotes::install_cran("rlang", force=TRUE) remotes::install_cran("magrittr", force=TRUE) remotes::install_cran("testthat", force=TRUE) + remotes::install_cran("glue", force=TRUE) shell: Rscript {0} - name: Check From 0de456e90ecf9dd777154d12fbd45de6b1b09984 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 14 Jun 2021 14:46:32 -0400 Subject: [PATCH 40/98] Only reset the DatasetMapper if the dimensionality is wrong. --- src/mlpack/core/data/load_csv.hpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/mlpack/core/data/load_csv.hpp b/src/mlpack/core/data/load_csv.hpp index e6e6569ea4..845d3f076f 100644 --- a/src/mlpack/core/data/load_csv.hpp +++ b/src/mlpack/core/data/load_csv.hpp @@ -96,7 +96,20 @@ class LoadCSV { ++rows; } - info = DatasetMapper(rows); + + // Reset the DatasetInfo object, if needed. + if (info.Dimensionality() == 0) + { + info = DatasetMapper(rows); + } + else if (info.Dimensionality() != rows) + { + std::ostringstream oss; + oss << "data::LoadCSV(): given DatasetInfo has dimensionality " + << info.Dimensionality() << ", but data has dimensionality " + << rows; + throw std::invalid_argument(oss.str()); + } // Now, jump back to the beginning of the file. inFile.clear(); @@ -179,8 +192,19 @@ class LoadCSV qi::parse(line.begin(), line.end(), stringRule[findRowSize] % delimiterRule); - // Now that we know the dimensionality, initialize the DatasetMapper. - info.SetDimensionality(rows); + // Reset the DatasetInfo object, if needed. + if (info.Dimensionality() == 0) + { + info = DatasetMapper(rows); + } + else if (info.Dimensionality() != rows) + { + std::ostringstream oss; + oss << "data::LoadCSV(): given DatasetInfo has dimensionality " + << info.Dimensionality() << ", but data has dimensionality " + << rows; + throw std::invalid_argument(oss.str()); + } } // If we need to do a first pass for the DatasetMapper, do it. From 7d416ed4a34213462e25bfd3d8bc9f7003f0a682 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 14 Jun 2021 14:51:56 -0400 Subject: [PATCH 41/98] Update documentation so it is correct. --- src/mlpack/core/data/load.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mlpack/core/data/load.hpp b/src/mlpack/core/data/load.hpp index 9b54f43ce1..03766d8eeb 100644 --- a/src/mlpack/core/data/load.hpp +++ b/src/mlpack/core/data/load.hpp @@ -273,8 +273,12 @@ bool Load(const std::string& filename, * mlpack requires column-major matrices, this should be left at its default * value of 'true'. * - * The DatasetMapper object passed to this function will be re-created, so any - * mappings from previous loads will be lost. + * If the given `info` has already been used with a different `data::Load()` + * call where the dataset has the same dimensionality, then the mappings and + * dimension types inside of `info` will be *re-used*. If the given `info` is a + * new `DatasetMapper` object (e.g. its dimensionality is 0), then new mappings + * will be created. If the given `info` has a different dimensionality of data + * than what is present in `filename`, an exception will be thrown. * * @param filename Name of file to load. * @param matrix Matrix to load contents of file into. From 2fc791085f3148b21ce3bc16cecc9882eda58ea4 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 14 Jun 2021 14:53:44 -0400 Subject: [PATCH 42/98] Update history. --- HISTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index d048cbdae1..1c1c157cf8 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -61,6 +61,8 @@ * Fix Julia model serialization bug (#2970). + * Fix `LoadCSV()` to use pre-populated `DatasetInfo` objects (#2980). + ### mlpack 3.4.2 ###### 2020-10-26 * Added Mean Absolute Percentage Error. From f6f59726a30bfe23136f0f960e1ea899ee16e58d Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 14 Jun 2021 14:54:39 -0400 Subject: [PATCH 43/98] Another one... --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e43652b442..99aa5dcb41 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -140,6 +140,7 @@ jobs: remotes::install_cran("magrittr", force=TRUE) remotes::install_cran("testthat", force=TRUE) remotes::install_cran("glue", force=TRUE) + remotes::install_cran("diffobj", force=TRUE) shell: Rscript {0} - name: Check From b4592ac4483030b12d7edffa7e7af5ea44c63e46 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 14 Jun 2021 17:17:32 -0400 Subject: [PATCH 44/98] I wonder what will happen if I do this? --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99aa5dcb41..2cca708c0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -128,6 +128,11 @@ jobs: key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }} restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}- + - name: Annihilate R environment + if: runner.os == 'macOS' + run: | + ls /Users/runner/work/_temp/Library/* && rm -rf /Users/runner/work/_temp/Library/* + - name: Install dependencies run: | remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) From d9bc6c8f307ed57adfbba2ff450c848bb0c546ef Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:25:56 +0530 Subject: [PATCH 45/98] added author link --- src/mlpack/methods/ann/layer/channel_shuffle.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle.hpp b/src/mlpack/methods/ann/layer/channel_shuffle.hpp index 27c747e84a..5e3eb273cb 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle.hpp @@ -21,6 +21,19 @@ namespace ann /** Artificial Neural Network. */ { * Channel Shuffle divides the channels/units in a tensor into groups * and rearrange while keeping the original tensor shape. * + * For more information, refer to the following paper, + * + * @code + * @article{zhang2018shufflenet, + * author = {Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, Jian Sun and + * Megvii Inc}, + * title = {Shufflenet: An extremely efficient convolutional neural + * network for mobile devices}, + * year = {2018}, + * url = {https://arxiv.org/pdf/1707.01083}, + * } + * @endcode + * * @tparam InputDataType Type of the input data (arma::colvec, arma::mat, * arma::sp_mat or arma::cube). * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat, From 832c1a3a3c5a07225824d4eadf0710b7dd3acb45 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:26:42 +0530 Subject: [PATCH 46/98] Apply suggestions from code review Co-authored-by: Marcus Edel --- src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp index 5a4c2886ed..0ebfe134d7 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp @@ -46,7 +46,7 @@ ChannelShuffle( { if (depth % groupCount != 0) { - Log::Fatal << "Number of channels must be divisible by groupCount.!" << std::endl; + Log::Fatal << "Number of channels must be divisible by groupCount!" << std::endl; } } @@ -69,7 +69,7 @@ void ChannelShuffle::Forward( arma::cube inputAsCube(const_cast&>(input).memptr(), inRowSize, inColSize, depth * batchSize, false, false); arma::cube outputAsCube(output.memptr(), inRowSize, inColSize, - depth * batchSize, false, true); + depth * batchSize, false, true); const size_t groupSize= depth / groupCount; size_t outChannelIdx = 0; @@ -105,7 +105,7 @@ void ChannelShuffle::Backward( arma::cube gradientAsCube(((arma::Mat&) gradient).memptr(), inColSize, inColSize, depth * batchSize, false, false); arma::cube outputAsCube(output.memptr(), inRowSize, inColSize, - depth * batchSize, false, true); + depth * batchSize, false, true); const size_t groupSize= depth / groupCount; size_t gradientChannelIdx = 0; From 537df20aa3510cd9b8f83c586c47f75b840b84db Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:28:44 +0530 Subject: [PATCH 47/98] Update ann_layer_test.cpp --- src/mlpack/tests/ann_layer_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index a8d7c4605a..137ea28aa9 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -4677,6 +4677,7 @@ TEST_CASE("ChannelShuffleLayerTest", "[ANNLayerTest]") << 11 << 23 << arma::endr << 12 << 24 << arma::endr; input1.reshape(24, 1); + // Value calculated using torch.nn.ChannelShuffle(). outputExpected1 << 1 << 17 << arma::endr << 2 << 18 << arma::endr << 3 << 19 << arma::endr From 12ecedfeb9f9c9b6f6332e9c6488a2bb7e42bcc5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 15 Jun 2021 08:24:45 -0400 Subject: [PATCH 48/98] Reinstall remotes. --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2cca708c0b..2a25279601 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,10 +131,12 @@ jobs: - name: Annihilate R environment if: runner.os == 'macOS' run: | - ls /Users/runner/work/_temp/Library/* && rm -rf /Users/runner/work/_temp/Library/* + ls /Users/runner/work/_temp/Library/* && find +/Users/runner/work/_temp/Library/* ! -name 'remotes' -maxdepth=1 -type d -delete - name: Install dependencies run: | + install.packages("remotes") remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) remotes::install_cran("rcmdcheck") remotes::install_cran("digest", force=TRUE) From 464b31d6ed372c5e1e61c69e0d144380e088605c Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 15 Jun 2021 11:35:35 -0400 Subject: [PATCH 49/98] Try to fix syntax. --- .github/workflows/main.yml | 4 ++-- src/mlpack/core/data/load.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a25279601..7b80b5fa95 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -132,11 +132,11 @@ jobs: if: runner.os == 'macOS' run: | ls /Users/runner/work/_temp/Library/* && find -/Users/runner/work/_temp/Library/* ! -name 'remotes' -maxdepth=1 -type d -delete +/Users/runner/work/_temp/Library/* \! -name 'remotes' -maxdepth=1 -type d -delete - name: Install dependencies run: | - install.packages("remotes") + install.packages('remotes') remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) remotes::install_cran("rcmdcheck") remotes::install_cran("digest", force=TRUE) diff --git a/src/mlpack/core/data/load.hpp b/src/mlpack/core/data/load.hpp index 9b54f43ce1..50ee8cdaf2 100644 --- a/src/mlpack/core/data/load.hpp +++ b/src/mlpack/core/data/load.hpp @@ -34,7 +34,7 @@ namespace data /** Functions to load and save matrices and models. */ { * * - CSV (arma::csv_ascii), denoted by .csv, or optionally .txt * - TSV (arma::raw_ascii), denoted by .tsv, .csv, or .txt - * - ASCII (arma::raw_ascii), denoted by .json + * - ASCII (arma::raw_ascii), denoted by .txt * - Armadillo ASCII (arma::arma_ascii), also denoted by .txt * - PGM (arma::pgm_binary), denoted by .pgm * - PPM (arma::ppm_binary), denoted by .ppm From 5c21ce9d02b7302e20d484b9107bf94b91f891c6 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 15 Jun 2021 11:37:28 -0400 Subject: [PATCH 50/98] Another attempt at a syntax fix. --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b80b5fa95..b0a42bc408 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,8 +131,7 @@ jobs: - name: Annihilate R environment if: runner.os == 'macOS' run: | - ls /Users/runner/work/_temp/Library/* && find -/Users/runner/work/_temp/Library/* \! -name 'remotes' -maxdepth=1 -type d -delete + ls /Users/runner/work/_temp/Library/* && rm -rf /Users/runner/work/_temp/Library/* - name: Install dependencies run: | From a6c0087fcc464c6f091f69bdb677a3ddbb10448d Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Tue, 15 Jun 2021 18:49:54 +0200 Subject: [PATCH 51/98] I do think these headers are useless here in this file. Let us see if the CI agrees with me. Signed-off-by: Omar Shrit --- src/mlpack/core/data/load_model_impl.hpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mlpack/core/data/load_model_impl.hpp b/src/mlpack/core/data/load_model_impl.hpp index ae5396b4fb..c62bad2673 100644 --- a/src/mlpack/core/data/load_model_impl.hpp +++ b/src/mlpack/core/data/load_model_impl.hpp @@ -15,15 +15,8 @@ // In case it hasn't already been included. #include "load.hpp" -#include -#include - #include "extension.hpp" -#include -#include -#include - #include #include #include From b4dd229c948d4c0e09c2f6e7fccb0ec9ad95f7a7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 15 Jun 2021 13:50:42 -0400 Subject: [PATCH 52/98] Wow! It worked! Now can I simplify it? --- .github/workflows/main.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0a42bc408..b461400b7f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,10 +38,10 @@ jobs: - name: Query dependencies run: | cp src/mlpack/bindings/R/mlpack/DESCRIPTION.in DESCRIPTION - Rscript --verbose -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds')" + Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds')" - name: Cache R packages - if: runner.os != 'Windows' + if: runner.os != 'Windows' && runner.os != 'macOS' uses: actions/cache@v1 with: path: ${{ env.R_LIBS_USER }} @@ -59,7 +59,6 @@ jobs: run: | remotes::install_deps(dependencies = TRUE) remotes::install_cran("roxygen2") - remotes::install_cran("processx", force = TRUE) shell: Rscript {0} - name: CMake @@ -121,17 +120,17 @@ jobs: run: Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE), 'depends.Rds')" - name: Cache R packages - if: runner.os != 'Windows' + if: runner.os != 'Windows' && runner.os != 'macOS' uses: actions/cache@v1 with: path: ${{ env.R_LIBS_USER }} key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }} restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}- - - name: Annihilate R environment - if: runner.os == 'macOS' - run: | - ls /Users/runner/work/_temp/Library/* && rm -rf /Users/runner/work/_temp/Library/* +# - name: Annihilate R environment +# if: runner.os == 'macOS' +# run: | +# ls /Users/runner/work/_temp/Library/* && rm -rf /Users/runner/work/_temp/Library/* - name: Install dependencies run: | @@ -150,7 +149,7 @@ jobs: shell: Rscript {0} - name: Check - run: Rscript --verbose -e "rcmdcheck::rcmdcheck('${{ needs.jobR.outputs.r_bindings }}', args = c('--no-manual','--as-cran'), error_on = 'warning', check_dir = 'check')" + run: Rscript -e "rcmdcheck::rcmdcheck('${{ needs.jobR.outputs.r_bindings }}', args = c('--no-manual','--as-cran'), error_on = 'warning', check_dir = 'check')" - name: Upload check results if: failure() From 4fc6a91d10b0bc572a8ff360d1a3e2208226f1e5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 15 Jun 2021 17:37:08 -0400 Subject: [PATCH 53/98] What if all I needed to do was disable the cache? --- .github/workflows/main.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b461400b7f..68da47424e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -127,25 +127,10 @@ jobs: key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }} restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}- -# - name: Annihilate R environment -# if: runner.os == 'macOS' -# run: | -# ls /Users/runner/work/_temp/Library/* && rm -rf /Users/runner/work/_temp/Library/* - - name: Install dependencies run: | install.packages('remotes') remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) - remotes::install_cran("rcmdcheck") - remotes::install_cran("digest", force=TRUE) - remotes::install_cran("ps", force=TRUE) - remotes::install_cran("processx", force=TRUE) - remotes::install_cran("Rcpp", force=TRUE) - remotes::install_cran("rlang", force=TRUE) - remotes::install_cran("magrittr", force=TRUE) - remotes::install_cran("testthat", force=TRUE) - remotes::install_cran("glue", force=TRUE) - remotes::install_cran("diffobj", force=TRUE) shell: Rscript {0} - name: Check From 346b0c893a903db216839d6cf21a754dbf99ef2c Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 15 Jun 2021 17:37:56 -0400 Subject: [PATCH 54/98] Oops, don't remove rcmdcheck. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 68da47424e..d53a06fa41 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,6 +131,7 @@ jobs: run: | install.packages('remotes') remotes::install_deps('${{ needs.jobR.outputs.r_bindings }}', dependencies = TRUE) + remotes::install_cran("rcmdcheck") shell: Rscript {0} - name: Check From ad2c512be224cef38f28e854ab95ed5e44305dc9 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Wed, 16 Jun 2021 14:32:17 +0200 Subject: [PATCH 55/98] Adding the missing boost headers. Still surprised were the headers removal hits. Signed-off-by: Omar Shrit --- src/mlpack/bindings/markdown/print_docs.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mlpack/bindings/markdown/print_docs.cpp b/src/mlpack/bindings/markdown/print_docs.cpp index 44adf69e93..636b203ee4 100644 --- a/src/mlpack/bindings/markdown/print_docs.cpp +++ b/src/mlpack/bindings/markdown/print_docs.cpp @@ -9,12 +9,14 @@ * 3-clause BSD license along with mlpack. If not, see * http://www.opensource.org/licenses/BSD-3-Clause for more information. */ +#include "binding_info.hpp" #include "print_docs.hpp" +#include "print_doc_functions.hpp" #include #include -#include "binding_info.hpp" -#include "print_doc_functions.hpp" + +#include // Make sure that this is defined. #ifndef DOXYGEN_PREFIX From 218e13843f10929588ef08714711e0464aad6c57 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Wed, 16 Jun 2021 16:14:41 +0200 Subject: [PATCH 56/98] Re-organize header, I am confused now Signed-off-by: Omar Shrit --- src/mlpack/bindings/markdown/print_docs.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mlpack/bindings/markdown/print_docs.cpp b/src/mlpack/bindings/markdown/print_docs.cpp index 636b203ee4..e103437f80 100644 --- a/src/mlpack/bindings/markdown/print_docs.cpp +++ b/src/mlpack/bindings/markdown/print_docs.cpp @@ -9,15 +9,15 @@ * 3-clause BSD license along with mlpack. If not, see * http://www.opensource.org/licenses/BSD-3-Clause for more information. */ -#include "binding_info.hpp" -#include "print_docs.hpp" -#include "print_doc_functions.hpp" - #include #include #include +#include "binding_info.hpp" +#include "print_docs.hpp" +#include "print_doc_functions.hpp" + // Make sure that this is defined. #ifndef DOXYGEN_PREFIX #define DOXYGEN_PREFIX "https://mlpack.org/doc/mlpack-git/doxygen/" From ae0f0124c8928e8336082f194cca010692ba4d88 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Wed, 16 Jun 2021 16:17:57 +0200 Subject: [PATCH 57/98] Increase the minimum required cmake version to compile mlpack Signed-off-by: Omar Shrit --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2bd365156..10b0e26225 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3.2) +cmake_minimum_required(VERSION 3.6) project(mlpack C CXX) include(CMake/cotire.cmake) From e48e4b7e810dc644759d19543974717759cb2f57 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 16 Jun 2021 14:24:42 -0400 Subject: [PATCH 58/98] Use SetDimensionality(); the constructor will lose the policy. --- src/mlpack/core/data/load_csv.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/core/data/load_csv.hpp b/src/mlpack/core/data/load_csv.hpp index 845d3f076f..ce7d0bb9b1 100644 --- a/src/mlpack/core/data/load_csv.hpp +++ b/src/mlpack/core/data/load_csv.hpp @@ -100,7 +100,7 @@ class LoadCSV // Reset the DatasetInfo object, if needed. if (info.Dimensionality() == 0) { - info = DatasetMapper(rows); + info.SetDimensionality(rows); } else if (info.Dimensionality() != rows) { @@ -195,7 +195,7 @@ class LoadCSV // Reset the DatasetInfo object, if needed. if (info.Dimensionality() == 0) { - info = DatasetMapper(rows); + info.SetDimensionality(rows); } else if (info.Dimensionality() != rows) { From aa6d55582622d3427b21ebfa0a630843eaadacf5 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Thu, 17 Jun 2021 10:00:20 +0530 Subject: [PATCH 59/98] Update src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp Co-authored-by: Marcus Edel --- src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp index 0ebfe134d7..6fda08704d 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp @@ -65,7 +65,6 @@ void ChannelShuffle::Forward( assert(output.n_cols == batchSize); } - arma::cube inputAsCube(const_cast&>(input).memptr(), inRowSize, inColSize, depth * batchSize, false, false); arma::cube outputAsCube(output.memptr(), inRowSize, inColSize, From 64b9d63f02156e75b79723d485402ba721edea83 Mon Sep 17 00:00:00 2001 From: Aakash kaushik Date: Thu, 17 Jun 2021 15:38:54 +0530 Subject: [PATCH 60/98] Padding layer fix for multiple filters (#2985) * padding fix for multiple filters * padding for single and multiple layers * add tests and comments * zero output fix(forgot to assign to subcube) * fixed the implementation * applying suggestions * tests failed because of wronginputdims that i gave * correct outputHeight and width * fix failing test * final test fix * tests pass --- src/mlpack/methods/ann/layer/padding.hpp | 47 ++++++++++++++++++- src/mlpack/methods/ann/layer/padding_impl.hpp | 42 ++++++++++++++--- src/mlpack/tests/ann_layer_test.cpp | 22 ++++++++- 3 files changed, 103 insertions(+), 8 deletions(-) diff --git a/src/mlpack/methods/ann/layer/padding.hpp b/src/mlpack/methods/ann/layer/padding.hpp index 7d8bf72d0d..eab4bb0f05 100644 --- a/src/mlpack/methods/ann/layer/padding.hpp +++ b/src/mlpack/methods/ann/layer/padding.hpp @@ -41,11 +41,15 @@ class Padding * @param padWRight Right padding width of the input. * @param padHTop Top padding height of the input. * @param padHBottom Bottom padding height of the input. + * @param inputWidth Width of the input. + * @param inputHeight Height of the input. */ Padding(const size_t padWLeft = 0, const size_t padWRight = 0, const size_t padHTop = 0, - const size_t padHBottom = 0); + const size_t padHBottom = 0, + const size_t inputWidth = 0, + const size_t inputHeight = 0); /** * Ordinary feed forward pass of a neural network, evaluating the function @@ -101,6 +105,26 @@ class Padding //! Modify the bottom padding width. size_t& PadHBottom() { return padHBottom; } + //! Get the input width. + size_t InputWidth() const { return inputWidth; } + //! Modify the input width. + size_t& InputWidth() { return inputWidth; } + + //! Get the input height. + size_t InputHeight() const { return inputHeight; } + //! Modify the input height. + size_t& InputHeight() { return inputHeight; } + + //! Get the output width. + size_t OutputWidth() const { return outputWidth; } + //! Modify the output width. + size_t& OutputWidth() { return outputWidth; } + + //! Get the output height. + size_t OutputHeight() const { return outputHeight; } + //! Modify the output height. + size_t& OutputHeight() { return outputHeight; } + /** * Serialize the layer. */ @@ -123,6 +147,27 @@ class Padding //! Locally-stored number of rows and columns of input. size_t nRows, nCols; + //! Locally-stored input height. + size_t inputHeight; + + //! Locally-stored input width. + size_t inputWidth; + + //! Locally-stored output height. + size_t outputHeight; + + //! Locally-stored output width. + size_t outputWidth; + + //! Locally-stored number of input channels. + size_t inSize; + + //! Locally-stored cube input parameter. + arma::cube inputTemp; + + //! Locally-stored output parameter. + arma::cube outputTemp; + //! Locally-stored delta object. OutputDataType delta; diff --git a/src/mlpack/methods/ann/layer/padding_impl.hpp b/src/mlpack/methods/ann/layer/padding_impl.hpp index 93936b5e69..29eabd1645 100644 --- a/src/mlpack/methods/ann/layer/padding_impl.hpp +++ b/src/mlpack/methods/ann/layer/padding_impl.hpp @@ -24,13 +24,17 @@ Padding::Padding( const size_t padWLeft, const size_t padWRight, const size_t padHTop, - const size_t padHBottom) : + const size_t padHBottom, + const size_t inputWidth, + const size_t inputHeight) : padWLeft(padWLeft), padWRight(padWRight), padHTop(padHTop), padHBottom(padHBottom), nRows(0), - nCols(0) + nCols(0), + inputHeight(inputWidth), + inputWidth(inputHeight) { // Nothing to do here. } @@ -42,10 +46,33 @@ void Padding::Forward( { nRows = input.n_rows; nCols = input.n_cols; - output = arma::zeros(nRows + padWLeft + padWRight, - nCols + padHTop + padHBottom); - output.submat(padWLeft, padHTop, padWLeft + nRows - 1, - padHTop + nCols - 1) = input; + + if (inputWidth == 0 || inputHeight == 0) + { + output = arma::zeros(nRows + padWLeft + padWRight, + nCols + padHTop + padHBottom); + output.submat(padWLeft, padHTop, padWLeft + nRows - 1, + padHTop + nCols - 1) = input; + } + else + { + inSize = input.n_elem / (inputWidth * inputHeight * nCols); + inputTemp = arma::Cube(const_cast&>(input).memptr(), + inputWidth, inputHeight, inSize * nCols, false, false); + outputTemp = arma::zeros>(inputWidth + padWLeft + padWRight, + inputHeight + padHTop + padHBottom, inSize * nCols); + for (size_t i = 0; i < inputTemp.n_slices; ++i) + { + outputTemp.slice(i).submat(padWLeft, padHTop, padWLeft + inputWidth - 1, + padHTop + inputHeight - 1) = inputTemp.slice(i); + } + + output = arma::Mat(outputTemp.memptr(), outputTemp.n_elem / nCols, + nCols); + } + + outputWidth = inputWidth + padWLeft + padWRight; + outputHeight = inputHeight + padHTop + padHBottom; } template @@ -68,9 +95,12 @@ void Padding::serialize( ar(CEREAL_NVP(padWRight)); ar(CEREAL_NVP(padHTop)); ar(CEREAL_NVP(padHBottom)); + ar(CEREAL_NVP(inputWidth)); + ar(CEREAL_NVP(inputHeight)); } } // namespace ann } // namespace mlpack #endif + \ No newline at end of file diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index 1d94b16560..b336789e46 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -697,7 +697,7 @@ TEST_CASE("SimpleLinearNoBiasLayerTest", "[ANNLayerTest]") */ TEST_CASE("SimplePaddingLayerTest", "[ANNLayerTest]") { - arma::mat output, input, delta; + arma::mat output, input, delta, input1, output1; Padding<> module(1, 2, 3, 4); // Test the Forward function. @@ -710,6 +710,26 @@ TEST_CASE("SimplePaddingLayerTest", "[ANNLayerTest]") // Test the Backward function. module.Backward(input, output, delta); CheckMatrices(delta, input); + + // Test forward function for multiple filters. + // Here it's 3 filters with height = 224, width = 224 + // the output should be [226 * 226 * 3, 1] with 1 padding. + Padding<> module1(1, 1, 1, 1, 224, 224); + input1 = arma::randu(224 * 224 * 3, 1); + module1.Forward(input1, output1); + REQUIRE(arma::accu(input1) == arma::accu(output1)); + REQUIRE(output1.n_rows == (226 * 226 * 3)); + REQUIRE(output1.n_cols == 1); + + // Test forward function for multiple batches with multiple filters. + // Here it's 3 filters with height = 244, width = 244 + // the output should be [246 * 246 * 3, 3] with 1 padding. + Padding<> module2(1 ,1, 1, 1, 244, 244); + input1 = arma::randu(244 * 244 * 3, 3); + module2.Forward(input1, output1); + REQUIRE(arma::accu(input1) == arma::accu(output1)); + REQUIRE(output1.n_rows == (246 * 246 * 3)); + REQUIRE(output1.n_cols == 3); } /** From 6428557f47cd36e4f0a0b0644fc78e97e5b6431d Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 18 Jun 2021 20:57:25 -0400 Subject: [PATCH 61/98] Include ensmallen so ENS_VERSION_MAJOR is defined. --- src/mlpack/methods/reinforcement_learning/q_learning.hpp | 1 + src/mlpack/methods/reinforcement_learning/sac.hpp | 1 + .../reinforcement_learning/worker/n_step_q_learning_worker.hpp | 1 + .../reinforcement_learning/worker/one_step_q_learning_worker.hpp | 1 + .../reinforcement_learning/worker/one_step_sarsa_worker.hpp | 1 + 5 files changed, 5 insertions(+) diff --git a/src/mlpack/methods/reinforcement_learning/q_learning.hpp b/src/mlpack/methods/reinforcement_learning/q_learning.hpp index afbdcff33e..3e03bb8c40 100644 --- a/src/mlpack/methods/reinforcement_learning/q_learning.hpp +++ b/src/mlpack/methods/reinforcement_learning/q_learning.hpp @@ -14,6 +14,7 @@ #define MLPACK_METHODS_RL_Q_LEARNING_HPP #include +#include #include "replay/random_replay.hpp" #include "replay/prioritized_replay.hpp" diff --git a/src/mlpack/methods/reinforcement_learning/sac.hpp b/src/mlpack/methods/reinforcement_learning/sac.hpp index f0431185f8..27ddb5cba0 100644 --- a/src/mlpack/methods/reinforcement_learning/sac.hpp +++ b/src/mlpack/methods/reinforcement_learning/sac.hpp @@ -14,6 +14,7 @@ #define MLPACK_METHODS_RL_SAC_HPP #include +#include #include "replay/random_replay.hpp" #include diff --git a/src/mlpack/methods/reinforcement_learning/worker/n_step_q_learning_worker.hpp b/src/mlpack/methods/reinforcement_learning/worker/n_step_q_learning_worker.hpp index b332752d64..4b052ec892 100644 --- a/src/mlpack/methods/reinforcement_learning/worker/n_step_q_learning_worker.hpp +++ b/src/mlpack/methods/reinforcement_learning/worker/n_step_q_learning_worker.hpp @@ -13,6 +13,7 @@ #ifndef MLPACK_METHODS_RL_WORKER_N_STEP_Q_LEARNING_WORKER_HPP #define MLPACK_METHODS_RL_WORKER_N_STEP_Q_LEARNING_WORKER_HPP +#include #include namespace mlpack { diff --git a/src/mlpack/methods/reinforcement_learning/worker/one_step_q_learning_worker.hpp b/src/mlpack/methods/reinforcement_learning/worker/one_step_q_learning_worker.hpp index a85d7cb13a..6916e22185 100644 --- a/src/mlpack/methods/reinforcement_learning/worker/one_step_q_learning_worker.hpp +++ b/src/mlpack/methods/reinforcement_learning/worker/one_step_q_learning_worker.hpp @@ -13,6 +13,7 @@ #ifndef MLPACK_METHODS_RL_WORKER_ONE_STEP_Q_LEARNING_WORKER_HPP #define MLPACK_METHODS_RL_WORKER_ONE_STEP_Q_LEARNING_WORKER_HPP +#include #include namespace mlpack { diff --git a/src/mlpack/methods/reinforcement_learning/worker/one_step_sarsa_worker.hpp b/src/mlpack/methods/reinforcement_learning/worker/one_step_sarsa_worker.hpp index 95451d30d4..1b114a1bde 100644 --- a/src/mlpack/methods/reinforcement_learning/worker/one_step_sarsa_worker.hpp +++ b/src/mlpack/methods/reinforcement_learning/worker/one_step_sarsa_worker.hpp @@ -13,6 +13,7 @@ #ifndef MLPACK_METHODS_RL_WORKER_ONE_STEP_SARSA_WORKER_HPP #define MLPACK_METHODS_RL_WORKER_ONE_STEP_SARSA_WORKER_HPP +#include #include namespace mlpack { From ec986cb4fe744923880e1d802ad98fcf98032f87 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 19 Jun 2021 22:51:53 +0200 Subject: [PATCH 62/98] Increase the cmake version in README Signed-off-by: Omar Shrit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 10f82a2c12..8e9ad6a05e 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ mlpack has the following dependencies: Armadillo >= 8.400.0 Boost (math_c99, spirit) >= 1.58.0 - CMake >= 3.2.2 + CMake >= 3.6 ensmallen >= 2.10.0 cereal >= 1.1.2 From fe2f32eb642b70680e12fb01c1508009b31f12f1 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 20 Jun 2021 09:04:56 +0200 Subject: [PATCH 63/98] Remove trailing space Signed-off-by: Omar Shrit --- CMake/ConfigureCrossCompile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/ConfigureCrossCompile.cmake b/CMake/ConfigureCrossCompile.cmake index 75e28bc453..ba78707ec3 100644 --- a/CMake/ConfigureCrossCompile.cmake +++ b/CMake/ConfigureCrossCompile.cmake @@ -33,7 +33,7 @@ macro(search_openblas version) endif() file(GLOB OPENBLAS_LIBRARIES "${CMAKE_BINARY_DIR}/deps/OpenBLAS-${version}/libopenblas.a") set(BLAS_openblas_LIBRARY ${OPENBLAS_LIBRARIES}) - set(LAPACK_openblas_LIBRARY ${OPENBLAS_LIBRARIES}) + set(LAPACK_openblas_LIBRARY ${OPENBLAS_LIBRARIES}) set(BLA_VENDOR OpenBLAS) set(BLAS_FOUND ON) endif() From e3276d9437002c13cb24705221b4cacadd18352c Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 20 Jun 2021 09:08:36 +0200 Subject: [PATCH 64/98] Do not check for BLAS and LAPACK if we are cross compiling and we have already found it. Signed-off-by: Omar Shrit --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19021de485..abddba2c1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -279,7 +279,7 @@ if (DISABLE_DOWNLOADS) find_package(Armadillo "${ARMADILLO_VERSION}" REQUIRED) else() find_package(Armadillo "${ARMADILLO_VERSION}") - if (NOT ARMADILLO_FOUND) + if (NOT ARMADILLO_FOUND AND NOT CMAKE_CROSSCOMPILING) find_package(BLAS QUIET) find_package(LAPACK QUIET) if (NOT BLAS_FOUND AND NOT LAPACK_FOUND) From 99e4b6b2aef26f416df1227ec88f60430c81034c Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 20 Jun 2021 10:35:05 +0200 Subject: [PATCH 65/98] Separate both of the check Signed-off-by: Omar Shrit --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abddba2c1f..cc5e4a5dc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -279,11 +279,13 @@ if (DISABLE_DOWNLOADS) find_package(Armadillo "${ARMADILLO_VERSION}" REQUIRED) else() find_package(Armadillo "${ARMADILLO_VERSION}") - if (NOT ARMADILLO_FOUND AND NOT CMAKE_CROSSCOMPILING) - find_package(BLAS QUIET) - find_package(LAPACK QUIET) - if (NOT BLAS_FOUND AND NOT LAPACK_FOUND) - message(FATAL_ERROR "Can not find BLAS or LAPACK! These are required for Armadillo. Please install one of them---or install Armadillo---before installing mlpack.") + if (NOT ARMADILLO_FOUND) + if (NOT CMAKE_CROSSCOMPILING) + find_package(BLAS QUIET) + find_package(LAPACK QUIET) + if (NOT BLAS_FOUND AND NOT LAPACK_FOUND) + message(FATAL_ERROR "Can not find BLAS or LAPACK! These are required for Armadillo. Please install one of them---or install Armadillo---before installing mlpack.") + endif() endif() get_deps(http://files.mlpack.org/armadillo-10.3.0.tar.gz armadillo armadillo-10.3.0.tar.gz) set(ARMADILLO_INCLUDE_DIR ${GENERIC_INCLUDE_DIR}) From ff1041282a4a700674c27b9fa5444fa8cbe3c091 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Sun, 20 Jun 2021 20:43:08 +0530 Subject: [PATCH 66/98] Improved speed of lp forward pass --- src/mlpack/methods/ann/layer/lp_pooling.hpp | 24 ++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/mlpack/methods/ann/layer/lp_pooling.hpp b/src/mlpack/methods/ann/layer/lp_pooling.hpp index 1c2b841e24..64ee64f607 100644 --- a/src/mlpack/methods/ann/layer/lp_pooling.hpp +++ b/src/mlpack/methods/ann/layer/lp_pooling.hpp @@ -161,12 +161,22 @@ class LpPooling template void Pooling(const arma::Mat& input, arma::Mat& output) { + arma::Mat inputPre = input; + input = arma::pow(input, normType); + + for (size_t i = 1; i < input.n_cols; ++i) + inputPre.col(i) += inputPre.col(i - 1); + + for (size_t i = 1; i < input.n_rows; ++i) + inputPre.row(i) += inputPre.row(i - 1); + for (size_t j = 0, colidx = 0; j < output.n_cols; ++j, colidx += strideHeight) { for (size_t i = 0, rowidx = 0; i < output.n_rows; ++i, rowidx += strideWidth) { + double val = 0.0; size_t rowEnd = rowidx + kernelWidth - 1; size_t colEnd = colidx + kernelHeight - 1; @@ -175,12 +185,16 @@ class LpPooling if (colEnd > input.n_cols - 1) colEnd = input.n_cols - 1; - arma::mat subInput = input( - arma::span(rowidx, rowEnd), - arma::span(colidx, colEnd)); + if (rowidx >= 1) + { + if (colidx >= 1) + val += inputPre(rowidx - 1, colidx - 1); + val -= inputPre(rowidx - 1, colEnd); + } + if (colidx >= 1) + val -= inputPre(rowEnd, colidx - 1); - output(i, j) = pow(arma::accu(arma::pow(subInput, - normType)), 1.0 / normType); + output(i, j) = pow(val, 1.0 / normType); } } } From 18efd64977ad3fd94179a125fa6b300aa3c2d5d6 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Sun, 20 Jun 2021 20:48:50 +0530 Subject: [PATCH 67/98] Fixed the computation of submatrix sum --- src/mlpack/methods/ann/layer/lp_pooling.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mlpack/methods/ann/layer/lp_pooling.hpp b/src/mlpack/methods/ann/layer/lp_pooling.hpp index 64ee64f607..7f97c0adc1 100644 --- a/src/mlpack/methods/ann/layer/lp_pooling.hpp +++ b/src/mlpack/methods/ann/layer/lp_pooling.hpp @@ -185,6 +185,7 @@ class LpPooling if (colEnd > input.n_cols - 1) colEnd = input.n_cols - 1; + val += inputPre(rowEnd, colEnd); if (rowidx >= 1) { if (colidx >= 1) From 821a2f27125e5233abce675b26ee31d588e4e4ff Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Sun, 20 Jun 2021 23:18:39 +0530 Subject: [PATCH 68/98] Update lp_pooling.hpp --- src/mlpack/methods/ann/layer/lp_pooling.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/lp_pooling.hpp b/src/mlpack/methods/ann/layer/lp_pooling.hpp index 7f97c0adc1..7af72e00bf 100644 --- a/src/mlpack/methods/ann/layer/lp_pooling.hpp +++ b/src/mlpack/methods/ann/layer/lp_pooling.hpp @@ -162,7 +162,7 @@ class LpPooling void Pooling(const arma::Mat& input, arma::Mat& output) { arma::Mat inputPre = input; - input = arma::pow(input, normType); + inputPre = arma::pow(inputPre, normType); for (size_t i = 1; i < input.n_cols; ++i) inputPre.col(i) += inputPre.col(i - 1); From 83207c4439ce3072e9b590cd6d2feeafdd25f2bd Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Mon, 21 Jun 2021 12:10:20 +0530 Subject: [PATCH 69/98] Use arma::pow to use fast armadillo computation --- src/mlpack/methods/ann/layer/lp_pooling.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/lp_pooling.hpp b/src/mlpack/methods/ann/layer/lp_pooling.hpp index 7af72e00bf..b87c496004 100644 --- a/src/mlpack/methods/ann/layer/lp_pooling.hpp +++ b/src/mlpack/methods/ann/layer/lp_pooling.hpp @@ -195,9 +195,10 @@ class LpPooling if (colidx >= 1) val -= inputPre(rowEnd, colidx - 1); - output(i, j) = pow(val, 1.0 / normType); + output(i, j) = val; } } + output = arma::pow(output, 1.0 / normType); } /** From a08bbf13169b3b4a6493b293b2481d678e4a9b04 Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Mon, 21 Jun 2021 14:18:52 +0530 Subject: [PATCH 70/98] Apply suggestions from code review Co-authored-by: kartikdutt18 <39593019+kartikdutt18@users.noreply.github.com> --- src/mlpack/methods/ann/layer/lp_pooling.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mlpack/methods/ann/layer/lp_pooling.hpp b/src/mlpack/methods/ann/layer/lp_pooling.hpp index b87c496004..ef8a12f2f8 100644 --- a/src/mlpack/methods/ann/layer/lp_pooling.hpp +++ b/src/mlpack/methods/ann/layer/lp_pooling.hpp @@ -192,12 +192,14 @@ class LpPooling val += inputPre(rowidx - 1, colidx - 1); val -= inputPre(rowidx - 1, colEnd); } + if (colidx >= 1) val -= inputPre(rowEnd, colidx - 1); output(i, j) = val; } } + output = arma::pow(output, 1.0 / normType); } From 9fc0513b26b14a5690b6d1fcb9022ada85b12d82 Mon Sep 17 00:00:00 2001 From: Marcus Edel Date: Tue, 22 Jun 2021 03:34:04 +0200 Subject: [PATCH 71/98] Style fixes (line length, extra spaces, newline). --- .../bindings/python/print_class_defn.hpp | 21 +++++++++++-------- src/mlpack/bindings/python/print_pyx.cpp | 6 ++++-- src/mlpack/methods/ann/layer/mean_pooling.hpp | 2 +- src/mlpack/methods/ann/layer/padding.hpp | 4 ++-- src/mlpack/methods/ann/layer/padding_impl.hpp | 5 ++--- src/mlpack/tests/ann_layer_test.cpp | 2 +- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/mlpack/bindings/python/print_class_defn.hpp b/src/mlpack/bindings/python/print_class_defn.hpp index ff1de4b26e..73b2a1fa68 100644 --- a/src/mlpack/bindings/python/print_class_defn.hpp +++ b/src/mlpack/bindings/python/print_class_defn.hpp @@ -63,11 +63,11 @@ void PrintClassDefn( * cdef class Type: * cdef * modelptr * cdef public dict scrubbed_params - * + * * def __cinit__(self): * self.modelptr = new () * self.scrubbed_params = dict() - * + * * def __dealloc__(self): * del self.modelptr * @@ -82,18 +82,18 @@ void PrintClassDefn( * * def _get_cpp_params(self): * return SerializeOutJSON(self.modelptr, "") - * + * * def _set_cpp_params(self, state): * SerializeInJSON(self.modelptr, state, "") - * + * * def get_cpp_params(self, return_str=False): * params = self._get_cpp_params() * return process_params_out(self, params, return_str=return_str) - * + * * def set_cpp_params(self, params_dic): * params_str = process_params_in(self, params_dic) * self._set_cpp_params(params_str) - * + * * @endcode */ std::cout << "cdef class " << strippedType << "Type:" << std::endl; @@ -129,11 +129,14 @@ void PrintClassDefn( std::cout << std::endl; std::cout << " def get_cpp_params(self, return_str=False):" << std::endl; std::cout << " params = self._get_cpp_params()" << std::endl; - std::cout << " return process_params_out(self, params, return_str=return_str)" << std::endl; + std::cout << " return process_params_out(self, params, " + << "return_str=return_str)" << std::endl; std::cout << std::endl; std::cout << " def set_cpp_params(self, params_dic):" << std::endl; - std::cout << " params_str = process_params_in(self, params_dic)" << std::endl; - std::cout << " self._set_cpp_params(params_str.encode(\"utf-8\"))" << std::endl; + std::cout << " params_str = process_params_in(self, params_dic)" + << std::endl; + std::cout << " self._set_cpp_params(params_str.encode(\"utf-8\"))" + << std::endl; std::cout << std::endl; } diff --git a/src/mlpack/bindings/python/print_pyx.cpp b/src/mlpack/bindings/python/print_pyx.cpp index e85e0fa082..6fd4899c3e 100644 --- a/src/mlpack/bindings/python/print_pyx.cpp +++ b/src/mlpack/bindings/python/print_pyx.cpp @@ -80,8 +80,10 @@ void PrintPYX(const util::BindingDetails& doc, cout << "from io cimport EnableVerbose, DisableVerbose, DisableBacktrace, " << "ResetTimers, EnableTimers" << endl; cout << "from matrix_utils import to_matrix, to_matrix_with_info" << endl; - cout << "from preprocess_json_params import process_params_out, process_params_in" << endl; - cout << "from serialization cimport SerializeIn, SerializeOut, SerializeOutJSON, SerializeInJSON" << endl; + cout << "from preprocess_json_params import process_params_out, " + << "process_params_in" << endl; + cout << "from serialization cimport SerializeIn, SerializeOut, " + << "SerializeOutJSON, SerializeInJSON" << endl; cout << endl; cout << "import numpy as np" << endl; cout << "cimport numpy as np" << endl; diff --git a/src/mlpack/methods/ann/layer/mean_pooling.hpp b/src/mlpack/methods/ann/layer/mean_pooling.hpp index 7789247018..4156667beb 100644 --- a/src/mlpack/methods/ann/layer/mean_pooling.hpp +++ b/src/mlpack/methods/ann/layer/mean_pooling.hpp @@ -216,7 +216,7 @@ class MeanPooling // `errorArea * kernalArea` and for each element in error we are doing `kernalArea` // number of operations. Whereas in the prefix method the total number of operations // will be `4 * errorArea + 2 * inputArea`. The term `2 * inputArea` comes from - // prefix sums performed (col-wise and row-wise). + // prefix sums performed (col-wise and row-wise). // We can use this to determine which method to use. const bool condition = (error.n_elem * kernelHeight * kernelWidth) > (4 * error.n_elem + 2 * input.n_elem); diff --git a/src/mlpack/methods/ann/layer/padding.hpp b/src/mlpack/methods/ann/layer/padding.hpp index eab4bb0f05..b7bfcab976 100644 --- a/src/mlpack/methods/ann/layer/padding.hpp +++ b/src/mlpack/methods/ann/layer/padding.hpp @@ -152,10 +152,10 @@ class Padding //! Locally-stored input width. size_t inputWidth; - + //! Locally-stored output height. size_t outputHeight; - + //! Locally-stored output width. size_t outputWidth; diff --git a/src/mlpack/methods/ann/layer/padding_impl.hpp b/src/mlpack/methods/ann/layer/padding_impl.hpp index 29eabd1645..73507a5f90 100644 --- a/src/mlpack/methods/ann/layer/padding_impl.hpp +++ b/src/mlpack/methods/ann/layer/padding_impl.hpp @@ -46,7 +46,7 @@ void Padding::Forward( { nRows = input.n_rows; nCols = input.n_cols; - + if (inputWidth == 0 || inputHeight == 0) { output = arma::zeros(nRows + padWLeft + padWRight, @@ -62,7 +62,7 @@ void Padding::Forward( outputTemp = arma::zeros>(inputWidth + padWLeft + padWRight, inputHeight + padHTop + padHBottom, inSize * nCols); for (size_t i = 0; i < inputTemp.n_slices; ++i) - { + { outputTemp.slice(i).submat(padWLeft, padHTop, padWLeft + inputWidth - 1, padHTop + inputHeight - 1) = inputTemp.slice(i); } @@ -103,4 +103,3 @@ void Padding::serialize( } // namespace mlpack #endif - \ No newline at end of file diff --git a/src/mlpack/tests/ann_layer_test.cpp b/src/mlpack/tests/ann_layer_test.cpp index b336789e46..5de93453dc 100644 --- a/src/mlpack/tests/ann_layer_test.cpp +++ b/src/mlpack/tests/ann_layer_test.cpp @@ -724,7 +724,7 @@ TEST_CASE("SimplePaddingLayerTest", "[ANNLayerTest]") // Test forward function for multiple batches with multiple filters. // Here it's 3 filters with height = 244, width = 244 // the output should be [246 * 246 * 3, 3] with 1 padding. - Padding<> module2(1 ,1, 1, 1, 244, 244); + Padding<> module2(1, 1, 1, 1, 244, 244); input1 = arma::randu(244 * 244 * 3, 3); module2.Forward(input1, output1); REQUIRE(arma::accu(input1) == arma::accu(output1)); From bcb3735a67ff26ad7f0c3325c918c1127414208c Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Tue, 22 Jun 2021 14:12:57 +0200 Subject: [PATCH 72/98] Use std::is_same instead of boost::is_same Signed-off-by: Omar Shrit --- src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp index 4f1282b276..fb906c59b0 100644 --- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp +++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp @@ -54,7 +54,7 @@ template::value, + static_assert(std::is_same::value, "RectangleTree: MetricType must be metric::EuclideanDistance."); public: From f1adf41a2e9941d850a5949fd80bad1ef5b0b6db Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Tue, 22 Jun 2021 14:17:06 +0200 Subject: [PATCH 73/98] Fix small bug JSON -> txt Signed-off-by: Omar Shrit --- src/mlpack/core/data/save.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mlpack/core/data/save.hpp b/src/mlpack/core/data/save.hpp index 6f8889cf8e..685e7ebeb3 100644 --- a/src/mlpack/core/data/save.hpp +++ b/src/mlpack/core/data/save.hpp @@ -32,7 +32,7 @@ namespace data /** Functions to load and save matrices. */ { * The supported types of files are the same as found in Armadillo: * * - CSV (arma::csv_ascii), denoted by .csv, or optionally .txt - * - ASCII (arma::raw_ascii), denoted by .json + * - ASCII (arma::raw_ascii), denoted by .txt * - Armadillo ASCII (arma::arma_ascii), also denoted by .txt * - PGM (arma::pgm_binary), denoted by .pgm * - PPM (arma::ppm_binary), denoted by .ppm From 8c09b1f4a73c28b4e45795c330d488c2f2d6b414 Mon Sep 17 00:00:00 2001 From: Marcus Edel Date: Tue, 22 Jun 2021 12:47:25 -0400 Subject: [PATCH 74/98] Apply suggestions from code review. Co-authored-by: Ryan Curtin --- src/mlpack/bindings/python/print_class_defn.hpp | 6 +++--- src/mlpack/bindings/python/print_pyx.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mlpack/bindings/python/print_class_defn.hpp b/src/mlpack/bindings/python/print_class_defn.hpp index 73b2a1fa68..158ae0ce7d 100644 --- a/src/mlpack/bindings/python/print_class_defn.hpp +++ b/src/mlpack/bindings/python/print_class_defn.hpp @@ -130,13 +130,13 @@ void PrintClassDefn( std::cout << " def get_cpp_params(self, return_str=False):" << std::endl; std::cout << " params = self._get_cpp_params()" << std::endl; std::cout << " return process_params_out(self, params, " - << "return_str=return_str)" << std::endl; + << "return_str=return_str)" << std::endl; std::cout << std::endl; std::cout << " def set_cpp_params(self, params_dic):" << std::endl; std::cout << " params_str = process_params_in(self, params_dic)" - << std::endl; + << std::endl; std::cout << " self._set_cpp_params(params_str.encode(\"utf-8\"))" - << std::endl; + << std::endl; std::cout << std::endl; } diff --git a/src/mlpack/bindings/python/print_pyx.cpp b/src/mlpack/bindings/python/print_pyx.cpp index 6fd4899c3e..4fcda954e9 100644 --- a/src/mlpack/bindings/python/print_pyx.cpp +++ b/src/mlpack/bindings/python/print_pyx.cpp @@ -81,7 +81,7 @@ void PrintPYX(const util::BindingDetails& doc, << "ResetTimers, EnableTimers" << endl; cout << "from matrix_utils import to_matrix, to_matrix_with_info" << endl; cout << "from preprocess_json_params import process_params_out, " - << "process_params_in" << endl; + << "process_params_in" << endl; cout << "from serialization cimport SerializeIn, SerializeOut, " << "SerializeOutJSON, SerializeInJSON" << endl; cout << endl; From 6f0ee6d0147e30fbfd70892bf4a95bfa0a1c7cbb Mon Sep 17 00:00:00 2001 From: abh2k <41710346+abh2k@users.noreply.github.com> Date: Thu, 24 Jun 2021 20:21:06 +0530 Subject: [PATCH 75/98] Update src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp Co-authored-by: kartikdutt18 <39593019+kartikdutt18@users.noreply.github.com> --- src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp index 6fda08704d..19062df91a 100644 --- a/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp +++ b/src/mlpack/methods/ann/layer/channel_shuffle_impl.hpp @@ -83,7 +83,6 @@ void ChannelShuffle::Forward( } } } - } template From 3740a1ac7cd9ac79e09d42a99a1bbc8e05e670d7 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 26 Jun 2021 17:05:57 +0200 Subject: [PATCH 76/98] First successful test Signed-off-by: Omar Shrit --- src/mlpack/bindings/cli/add_to_cli11.hpp | 76 ++++++++++++------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/mlpack/bindings/cli/add_to_cli11.hpp b/src/mlpack/bindings/cli/add_to_cli11.hpp index ceb03c64e2..cf117067d3 100644 --- a/src/mlpack/bindings/cli/add_to_cli11.hpp +++ b/src/mlpack/bindings/cli/add_to_cli11.hpp @@ -33,15 +33,15 @@ template void AddToCLI11(const std::string& cliName, util::ParamData& param, CLI::App& app, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if< - arma::is_arma_type>::type* = 0, - const typename boost::disable_if< - data::HasSerialize>::type* = 0, - const typename boost::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>>::type* = 0) + arma::mat>>::value>::type* = 0) { app.add_option_function(cliName.c_str(), [¶m](const std::string& value) @@ -65,15 +65,15 @@ template void AddToCLI11(const std::string& cliName, util::ParamData& param, CLI::App& app, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if< - arma::is_arma_type>::type* = 0, - const typename boost::enable_if< - data::HasSerialize>::type* = 0, - const typename boost::disable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if< + data::HasSerialize::value>::type* = 0, + const typename std::enable_if>>::type* = 0) + arma::mat>>::value>::type* = 0) { app.add_option_function(cliName.c_str(), [¶m](const std::string& value) @@ -97,13 +97,13 @@ template void AddToCLI11(const std::string& cliName, util::ParamData& param, CLI::App& app, - const typename boost::disable_if< - std::is_same>::type* = 0, - const typename boost::enable_if< - arma::is_arma_type>::type* = 0, - const typename boost::disable_if::value>::type* = 0, + const typename std::enable_if< + arma::is_arma_type::value>::type* = 0, + const typename std::enable_if>>::type* = 0) + arma::mat>>::value>::type* = 0) { app.add_option_function(cliName.c_str(), [¶m](const std::string& value) @@ -127,15 +127,15 @@ template void AddToCLI11(const std::string& cliName, util::ParamData& param, CLI::App& app, - const typename boost::disable_if< - std::is_same>::type* = 0, - const typename boost::disable_if< - arma::is_arma_type>::type* = 0, - const typename boost::disable_if< - data::HasSerialize>::type* = 0, - const typename boost::disable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>>::type* = 0) + arma::mat>>::value>::type* = 0) { app.add_option_function(cliName.c_str(), [¶m](const T& value) @@ -157,15 +157,15 @@ template void AddToCLI11(const std::string& cliName, util::ParamData& param, CLI::App& app, - const typename boost::enable_if< - std::is_same>::type* = 0, - const typename boost::disable_if< - arma::is_arma_type>::type* = 0, - const typename boost::disable_if< - data::HasSerialize>::type* = 0, - const typename boost::disable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>>::type* = 0) + arma::mat>>::value>::type* = 0) { app.add_flag_function(cliName.c_str(), [¶m](const T& value) From 93de3217f20a471c2d1e5b1611c5b64107584e7c Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 26 Jun 2021 18:04:37 +0200 Subject: [PATCH 77/98] Remove half of boost in this directory Signed-off-by: Omar Shrit --- src/mlpack/bindings/cli/default_param.hpp | 20 ++++++++--------- .../bindings/cli/default_param_impl.hpp | 20 ++++++++--------- .../bindings/cli/get_printable_param.hpp | 14 ++++++------ .../bindings/cli/get_printable_param_name.hpp | 18 +++++++-------- .../cli/get_printable_param_name_impl.hpp | 18 +++++++-------- .../bindings/cli/get_printable_type_impl.hpp | 14 ++++++------ src/mlpack/bindings/cli/output_param.hpp | 22 +++++++++---------- src/mlpack/bindings/cli/output_param_impl.hpp | 22 +++++++++---------- src/mlpack/bindings/cli/print_type_doc.hpp | 14 ++++++------ .../bindings/cli/print_type_doc_impl.hpp | 14 ++++++------ 10 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/mlpack/bindings/cli/default_param.hpp b/src/mlpack/bindings/cli/default_param.hpp index 1eecd76eec..f8a7ea894c 100644 --- a/src/mlpack/bindings/cli/default_param.hpp +++ b/src/mlpack/bindings/cli/default_param.hpp @@ -26,12 +26,12 @@ namespace cli { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return the default value of a vector option. @@ -39,7 +39,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a string option. @@ -47,7 +47,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a matrix option, a tuple option, a @@ -69,8 +69,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Return the default value of an option. This is the function that will be diff --git a/src/mlpack/bindings/cli/default_param_impl.hpp b/src/mlpack/bindings/cli/default_param_impl.hpp index 26e9d7e6cd..db95caf008 100644 --- a/src/mlpack/bindings/cli/default_param_impl.hpp +++ b/src/mlpack/bindings/cli/default_param_impl.hpp @@ -24,12 +24,12 @@ namespace cli { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type* /* junk */) { std::ostringstream oss; if (!std::is_same::value) @@ -44,7 +44,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { // Print each element in an array delimited by square brackets. std::ostringstream oss; @@ -88,7 +88,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { const std::string& s = *boost::any_cast(&data.value); return "'" + s + "'"; @@ -115,8 +115,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { return "''"; } diff --git a/src/mlpack/bindings/cli/get_printable_param.hpp b/src/mlpack/bindings/cli/get_printable_param.hpp index ca13c679e9..2cd2221101 100644 --- a/src/mlpack/bindings/cli/get_printable_param.hpp +++ b/src/mlpack/bindings/cli/get_printable_param.hpp @@ -27,11 +27,11 @@ namespace cli { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Print a vector option, with spaces between it. @@ -57,8 +57,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print an option into a std::string. This should print a short, one-line diff --git a/src/mlpack/bindings/cli/get_printable_param_name.hpp b/src/mlpack/bindings/cli/get_printable_param_name.hpp index 38d3c64164..b875d2f72d 100644 --- a/src/mlpack/bindings/cli/get_printable_param_name.hpp +++ b/src/mlpack/bindings/cli/get_printable_param_name.hpp @@ -26,10 +26,10 @@ namespace cli { template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter name for a matrix type (where the user has to pass the file @@ -38,7 +38,7 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a serializable model type (where the user has to @@ -47,8 +47,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a mapped matrix type (where the user has to pass @@ -57,8 +57,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter's name as seen by the user. diff --git a/src/mlpack/bindings/cli/get_printable_param_name_impl.hpp b/src/mlpack/bindings/cli/get_printable_param_name_impl.hpp index 4bb0da75e0..7c355c3dbc 100644 --- a/src/mlpack/bindings/cli/get_printable_param_name_impl.hpp +++ b/src/mlpack/bindings/cli/get_printable_param_name_impl.hpp @@ -26,10 +26,10 @@ namespace cli { template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "--" + data.name; } @@ -41,7 +41,7 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { return "--" + data.name + "_file"; } @@ -53,8 +53,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "--" + data.name + "_file"; } @@ -66,8 +66,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>>::type*) + const typename std::enable_if>::value>::type*) { return "--" + data.name + "_file"; } diff --git a/src/mlpack/bindings/cli/get_printable_type_impl.hpp b/src/mlpack/bindings/cli/get_printable_type_impl.hpp index 7e7da8b038..d02dae49fc 100644 --- a/src/mlpack/bindings/cli/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/cli/get_printable_type_impl.hpp @@ -25,11 +25,11 @@ namespace cli { template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { if (std::is_same::value) return "flag"; @@ -101,8 +101,8 @@ std::string GetPrintableType( template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return data.cppType + " file"; } diff --git a/src/mlpack/bindings/cli/output_param.hpp b/src/mlpack/bindings/cli/output_param.hpp index 898f2d1a39..bef23ed43e 100644 --- a/src/mlpack/bindings/cli/output_param.hpp +++ b/src/mlpack/bindings/cli/output_param.hpp @@ -26,11 +26,11 @@ namespace cli { template void OutputParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Output a vector option (print to stdout). @@ -38,7 +38,7 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Output a matrix option (this saves it to the given file). @@ -46,7 +46,7 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Output a serializable class option (this saves it to the given file). @@ -54,8 +54,8 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Output a mapped dataset. @@ -63,8 +63,8 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); /** * Output an option. This is the function that will be called by the IO diff --git a/src/mlpack/bindings/cli/output_param_impl.hpp b/src/mlpack/bindings/cli/output_param_impl.hpp index ab2f1e8822..d34b55fd74 100644 --- a/src/mlpack/bindings/cli/output_param_impl.hpp +++ b/src/mlpack/bindings/cli/output_param_impl.hpp @@ -24,11 +24,11 @@ namespace cli { template void OutputParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if>::value>::type* /* junk */) { std::cout << data.name << ": " << *boost::any_cast(&data.value) << std::endl; @@ -38,7 +38,7 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { std::cout << data.name << ": "; const T& t = *boost::any_cast(&data.value); @@ -51,7 +51,7 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { typedef std::tuple> TupleType; const T& output = std::get<0>(*boost::any_cast(&data.value)); @@ -71,8 +71,8 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { // The const cast is necessary here because Serialize() can't ever be marked // const. In this case we can assume it though, since we will be saving and @@ -91,8 +91,8 @@ void OutputParamImpl( template void OutputParamImpl( util::ParamData& data, - const typename boost::enable_if>>::type* /* junk */) + const typename std::enable_if>::value>::type* /* junk */) { // Output the matrix with the mappings. typedef std::tuple> TupleType; diff --git a/src/mlpack/bindings/cli/print_type_doc.hpp b/src/mlpack/bindings/cli/print_type_doc.hpp index 873d5465f2..10acab4f5b 100644 --- a/src/mlpack/bindings/cli/print_type_doc.hpp +++ b/src/mlpack/bindings/cli/print_type_doc.hpp @@ -25,11 +25,11 @@ namespace cli { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return a string representing the command-line type of a vector. @@ -62,8 +62,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print the command-line type of an option into a string. diff --git a/src/mlpack/bindings/cli/print_type_doc_impl.hpp b/src/mlpack/bindings/cli/print_type_doc_impl.hpp index 51e3106de5..1836732bf8 100644 --- a/src/mlpack/bindings/cli/print_type_doc_impl.hpp +++ b/src/mlpack/bindings/cli/print_type_doc_impl.hpp @@ -24,11 +24,11 @@ namespace cli { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { // A flag type. if (std::is_same::value) @@ -165,8 +165,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& /* data */, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "A filename containing an mlpack model. These can have one of three " "formats: binary (.bin), text (.txt), and XML (.xml). The XML format " From 632b43b46717096b91eae46a008c31711bfe7db3 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 26 Jun 2021 18:54:19 +0200 Subject: [PATCH 78/98] Compiling, remove boost_enable_if entirely from CLI binding Signed-off-by: Omar Shrit --- src/mlpack/bindings/cli/default_param.hpp | 2 +- src/mlpack/bindings/cli/default_param_impl.hpp | 2 +- .../bindings/cli/delete_allocated_memory.hpp | 10 +++++----- .../bindings/cli/get_allocated_memory.hpp | 10 +++++----- src/mlpack/bindings/cli/get_param.hpp | 18 +++++++++--------- .../bindings/cli/get_printable_param_impl.hpp | 14 +++++++------- .../bindings/cli/get_printable_param_value.hpp | 18 +++++++++--------- .../cli/get_printable_param_value_impl.hpp | 18 +++++++++--------- src/mlpack/bindings/cli/get_printable_type.hpp | 14 +++++++------- src/mlpack/bindings/cli/get_raw_param.hpp | 14 +++++++------- src/mlpack/bindings/cli/map_parameter_name.hpp | 10 +++++----- src/mlpack/bindings/cli/set_param.hpp | 18 +++++++++--------- src/mlpack/bindings/cli/string_type_param.hpp | 8 ++++---- .../bindings/cli/string_type_param_impl.hpp | 8 ++++---- 14 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/mlpack/bindings/cli/default_param.hpp b/src/mlpack/bindings/cli/default_param.hpp index f8a7ea894c..093a03c567 100644 --- a/src/mlpack/bindings/cli/default_param.hpp +++ b/src/mlpack/bindings/cli/default_param.hpp @@ -57,7 +57,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */ = 0); diff --git a/src/mlpack/bindings/cli/default_param_impl.hpp b/src/mlpack/bindings/cli/default_param_impl.hpp index db95caf008..b002e94611 100644 --- a/src/mlpack/bindings/cli/default_param_impl.hpp +++ b/src/mlpack/bindings/cli/default_param_impl.hpp @@ -100,7 +100,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */) diff --git a/src/mlpack/bindings/cli/delete_allocated_memory.hpp b/src/mlpack/bindings/cli/delete_allocated_memory.hpp index 35d305bb99..f3123c52e8 100644 --- a/src/mlpack/bindings/cli/delete_allocated_memory.hpp +++ b/src/mlpack/bindings/cli/delete_allocated_memory.hpp @@ -21,8 +21,8 @@ namespace cli { template void DeleteAllocatedMemoryImpl( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Do nothing. } @@ -30,7 +30,7 @@ void DeleteAllocatedMemoryImpl( template void DeleteAllocatedMemoryImpl( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Do nothing. } @@ -38,8 +38,8 @@ void DeleteAllocatedMemoryImpl( template void DeleteAllocatedMemoryImpl( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Delete the allocated memory (hopefully we actually own it). typedef std::tuple TupleType; diff --git a/src/mlpack/bindings/cli/get_allocated_memory.hpp b/src/mlpack/bindings/cli/get_allocated_memory.hpp index 0f70fe0adf..08e97e1e39 100644 --- a/src/mlpack/bindings/cli/get_allocated_memory.hpp +++ b/src/mlpack/bindings/cli/get_allocated_memory.hpp @@ -22,8 +22,8 @@ namespace cli { template void* GetAllocatedMemory( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return NULL; } @@ -31,7 +31,7 @@ void* GetAllocatedMemory( template void* GetAllocatedMemory( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { return NULL; } @@ -39,8 +39,8 @@ void* GetAllocatedMemory( template void* GetAllocatedMemory( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Here we have a model, which is a tuple, and we need the address of the // memory. diff --git a/src/mlpack/bindings/cli/get_param.hpp b/src/mlpack/bindings/cli/get_param.hpp index d401e0e554..34463e939c 100644 --- a/src/mlpack/bindings/cli/get_param.hpp +++ b/src/mlpack/bindings/cli/get_param.hpp @@ -28,10 +28,10 @@ namespace cli { template T& GetParam( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { // No mapping is needed, so just cast it directly. return *boost::any_cast(&d.value); @@ -45,7 +45,7 @@ T& GetParam( template T& GetParam( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // If the matrix is an input matrix, we have to load the matrix. 'value' // contains the filename. It's possible we could load empty matrices many @@ -80,8 +80,8 @@ T& GetParam( template T& GetParam( util::ParamData& d, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // If this is an input parameter, we need to load both the matrix and the // dataset info. @@ -110,8 +110,8 @@ T& GetParam( template T*& GetParam( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // If the model is an input model, we have to load it from file. 'value' // contains the filename. diff --git a/src/mlpack/bindings/cli/get_printable_param_impl.hpp b/src/mlpack/bindings/cli/get_printable_param_impl.hpp index 9898c49ee6..89f3c066f0 100644 --- a/src/mlpack/bindings/cli/get_printable_param_impl.hpp +++ b/src/mlpack/bindings/cli/get_printable_param_impl.hpp @@ -23,11 +23,11 @@ namespace cli { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if>::value>::type* /* junk */) { std::ostringstream oss; oss << boost::any_cast(data.value); @@ -103,8 +103,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { // Extract the string from the tuple that's being held. typedef std::tuple::type> TupleType; diff --git a/src/mlpack/bindings/cli/get_printable_param_value.hpp b/src/mlpack/bindings/cli/get_printable_param_value.hpp index 208afdb87b..621640b3c1 100644 --- a/src/mlpack/bindings/cli/get_printable_param_value.hpp +++ b/src/mlpack/bindings/cli/get_printable_param_value.hpp @@ -27,10 +27,10 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter name for a matrix type (where the user has to pass the file @@ -40,7 +40,7 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a serializable model type (where the user has to @@ -50,8 +50,8 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a mapped matrix type (where the user has to pass @@ -61,8 +61,8 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter's name as seen by the user. diff --git a/src/mlpack/bindings/cli/get_printable_param_value_impl.hpp b/src/mlpack/bindings/cli/get_printable_param_value_impl.hpp index 09389614a1..3bb42b01b1 100644 --- a/src/mlpack/bindings/cli/get_printable_param_value_impl.hpp +++ b/src/mlpack/bindings/cli/get_printable_param_value_impl.hpp @@ -28,10 +28,10 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return input; } @@ -44,7 +44,7 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { return input + ".csv"; } @@ -57,8 +57,8 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return input + ".bin"; } @@ -71,8 +71,8 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::enable_if>>::type*) + const typename std::enable_if>::value>::type*) { return input + ".arff"; } diff --git a/src/mlpack/bindings/cli/get_printable_type.hpp b/src/mlpack/bindings/cli/get_printable_type.hpp index 9c29711240..07fd10609a 100644 --- a/src/mlpack/bindings/cli/get_printable_type.hpp +++ b/src/mlpack/bindings/cli/get_printable_type.hpp @@ -23,11 +23,11 @@ namespace cli { template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return a string representing the command-line type of a vector. @@ -60,8 +60,8 @@ std::string GetPrintableType( template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print the command-line type of an option into a string. diff --git a/src/mlpack/bindings/cli/get_raw_param.hpp b/src/mlpack/bindings/cli/get_raw_param.hpp index 46c3956a1f..38b340387e 100644 --- a/src/mlpack/bindings/cli/get_raw_param.hpp +++ b/src/mlpack/bindings/cli/get_raw_param.hpp @@ -27,10 +27,10 @@ namespace cli { template T& GetRawParam( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { // No mapping is needed, so just cast it directly. return *boost::any_cast(&d.value); @@ -42,7 +42,7 @@ T& GetRawParam( template T& GetRawParam( util::ParamData& d, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* = 0) @@ -59,8 +59,8 @@ T& GetRawParam( template T*& GetRawParam( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Don't load the model. typedef std::tuple TupleType; diff --git a/src/mlpack/bindings/cli/map_parameter_name.hpp b/src/mlpack/bindings/cli/map_parameter_name.hpp index 1835bd5602..74f20a6431 100644 --- a/src/mlpack/bindings/cli/map_parameter_name.hpp +++ b/src/mlpack/bindings/cli/map_parameter_name.hpp @@ -27,10 +27,10 @@ namespace cli { template std::string MapParameterName( const std::string& identifier, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { return identifier; } @@ -43,7 +43,7 @@ std::string MapParameterName( template std::string MapParameterName( const std::string& identifier, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value || diff --git a/src/mlpack/bindings/cli/set_param.hpp b/src/mlpack/bindings/cli/set_param.hpp index f800fe0553..f76f058d2e 100644 --- a/src/mlpack/bindings/cli/set_param.hpp +++ b/src/mlpack/bindings/cli/set_param.hpp @@ -27,11 +27,11 @@ template void SetParam( util::ParamData& d, const boost::any& value, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // No mapping is needed. d.value = value; @@ -44,7 +44,7 @@ template void SetParam( util::ParamData& d, const boost::any& /* value */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Force set to the value of whether or not this was passed. d.value = d.wasPassed; @@ -60,7 +60,7 @@ void SetParam( const boost::any& value, const typename std::enable_if::value || std::is_same>::value>::type* = 0) + std::tuple>::value::value>::type* = 0) { // We're setting the string filename. typedef std::tuple::type> TupleType; @@ -76,8 +76,8 @@ template void SetParam( util::ParamData& d, const boost::any& value, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // We're setting the string filename. typedef std::tuple::type> TupleType; diff --git a/src/mlpack/bindings/cli/string_type_param.hpp b/src/mlpack/bindings/cli/string_type_param.hpp index eb4550e3ca..decf9e794d 100644 --- a/src/mlpack/bindings/cli/string_type_param.hpp +++ b/src/mlpack/bindings/cli/string_type_param.hpp @@ -26,22 +26,22 @@ namespace cli { */ template std::string StringTypeParamImpl( - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Return a string containing the type of the parameter, for vector options. */ template std::string StringTypeParamImpl( - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return a string containing the type of the parameter, */ template std::string StringTypeParamImpl( - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return a string containing the type of a parameter. This overload is used if diff --git a/src/mlpack/bindings/cli/string_type_param_impl.hpp b/src/mlpack/bindings/cli/string_type_param_impl.hpp index 7bf1df6516..195d1b5a3b 100644 --- a/src/mlpack/bindings/cli/string_type_param_impl.hpp +++ b/src/mlpack/bindings/cli/string_type_param_impl.hpp @@ -23,8 +23,8 @@ namespace cli { */ template std::string StringTypeParamImpl( - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { // Don't know what type this is. return "unknown"; @@ -35,7 +35,7 @@ std::string StringTypeParamImpl( */ template std::string StringTypeParamImpl( - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { return "vector"; } @@ -45,7 +45,7 @@ std::string StringTypeParamImpl( */ template std::string StringTypeParamImpl( - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { return "string"; } From 88ddd5baf470428aba2213c3a3edef72416f96b0 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 26 Jun 2021 19:38:24 +0200 Subject: [PATCH 79/98] Yeah, markdown have changed now Signed-off-by: Omar Shrit --- .../bindings/cli/get_printable_type_impl.hpp | 2 +- .../bindings/markdown/get_printable_param.hpp | 22 +++++++++---------- .../markdown/get_printable_param_name.hpp | 18 +++++++-------- .../get_printable_param_name_impl.hpp | 18 +++++++-------- .../markdown/get_printable_param_value.hpp | 18 +++++++-------- .../get_printable_param_value_impl.hpp | 18 +++++++-------- .../bindings/markdown/is_serializable.hpp | 6 ++--- 7 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/mlpack/bindings/cli/get_printable_type_impl.hpp b/src/mlpack/bindings/cli/get_printable_type_impl.hpp index d02dae49fc..14a259b8b6 100644 --- a/src/mlpack/bindings/cli/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/cli/get_printable_type_impl.hpp @@ -101,7 +101,7 @@ std::string GetPrintableType( template std::string GetPrintableType( util::ParamData& data, - const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*) { return data.cppType + " file"; diff --git a/src/mlpack/bindings/markdown/get_printable_param.hpp b/src/mlpack/bindings/markdown/get_printable_param.hpp index 91df84d61f..e94e9a7ca9 100644 --- a/src/mlpack/bindings/markdown/get_printable_param.hpp +++ b/src/mlpack/bindings/markdown/get_printable_param.hpp @@ -25,11 +25,11 @@ namespace markdown { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { std::ostringstream oss; oss << boost::any_cast(data.value); @@ -42,7 +42,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const T& t = boost::any_cast(data.value); @@ -58,7 +58,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Get the matrix. const T& matrix = boost::any_cast(data.value); @@ -74,8 +74,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { std::ostringstream oss; oss << data.cppType << " model at " << boost::any_cast(data.value); @@ -88,8 +88,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // Get the matrix. const T& tuple = boost::any_cast(data.value); diff --git a/src/mlpack/bindings/markdown/get_printable_param_name.hpp b/src/mlpack/bindings/markdown/get_printable_param_name.hpp index 9d19c05f6d..c222ea10fd 100644 --- a/src/mlpack/bindings/markdown/get_printable_param_name.hpp +++ b/src/mlpack/bindings/markdown/get_printable_param_name.hpp @@ -26,10 +26,10 @@ namespace markdown { template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter name for a matrix type (where the user has to pass the file @@ -38,7 +38,7 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a serializable model type (where the user has to @@ -47,8 +47,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a mapped matrix type (where the user has to pass @@ -57,8 +57,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter's name as seen by the user. diff --git a/src/mlpack/bindings/markdown/get_printable_param_name_impl.hpp b/src/mlpack/bindings/markdown/get_printable_param_name_impl.hpp index 5a7a63a001..b7e9f91fac 100644 --- a/src/mlpack/bindings/markdown/get_printable_param_name_impl.hpp +++ b/src/mlpack/bindings/markdown/get_printable_param_name_impl.hpp @@ -26,10 +26,10 @@ namespace markdown { template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "--" + data.name; } @@ -41,7 +41,7 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { return "--" + data.name + "_file"; } @@ -53,8 +53,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "--" + data.name + "_file"; } @@ -66,8 +66,8 @@ std::string GetPrintableParamName( template std::string GetPrintableParamName( util::ParamData& data, - const typename boost::enable_if>>::type*) + const typename std::enable_if>::value>::type*) { return "--" + data.name + "_file"; } diff --git a/src/mlpack/bindings/markdown/get_printable_param_value.hpp b/src/mlpack/bindings/markdown/get_printable_param_value.hpp index c7e44ebd07..a0708fc2af 100644 --- a/src/mlpack/bindings/markdown/get_printable_param_value.hpp +++ b/src/mlpack/bindings/markdown/get_printable_param_value.hpp @@ -27,10 +27,10 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter name for a matrix type (where the user has to pass the file @@ -40,7 +40,7 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a serializable model type (where the user has to @@ -50,8 +50,8 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Get the parameter name for a mapped matrix type (where the user has to pass @@ -61,8 +61,8 @@ template std::string GetPrintableParamValue( util::ParamData& data, const std::string& value, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); /** * Get the parameter's name as seen by the user. diff --git a/src/mlpack/bindings/markdown/get_printable_param_value_impl.hpp b/src/mlpack/bindings/markdown/get_printable_param_value_impl.hpp index 22da560948..0753a7b03e 100644 --- a/src/mlpack/bindings/markdown/get_printable_param_value_impl.hpp +++ b/src/mlpack/bindings/markdown/get_printable_param_value_impl.hpp @@ -28,10 +28,10 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return input; } @@ -44,7 +44,7 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { return input + ".csv"; } @@ -57,8 +57,8 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return input + ".bin"; } @@ -71,8 +71,8 @@ template std::string GetPrintableParamValue( util::ParamData& /* data */, const std::string& input, - const typename boost::enable_if>>::type*) + const typename std::enable_if>::value>::type*) { return input + ".arff"; } diff --git a/src/mlpack/bindings/markdown/is_serializable.hpp b/src/mlpack/bindings/markdown/is_serializable.hpp index daeda8e9cb..fa66d53f08 100644 --- a/src/mlpack/bindings/markdown/is_serializable.hpp +++ b/src/mlpack/bindings/markdown/is_serializable.hpp @@ -25,7 +25,7 @@ namespace markdown { */ template bool IsSerializable( - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { return false; } @@ -35,8 +35,8 @@ bool IsSerializable( */ template bool IsSerializable( - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return true; } From 20e114a8248732fe5718c2028e4a671c4ed6da83 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 26 Jun 2021 20:31:18 +0200 Subject: [PATCH 80/98] Yeah, Julia bindings too. Signed-off-by: Omar Shrit --- src/mlpack/bindings/julia/default_param.hpp | 24 +++++++++---------- .../bindings/julia/default_param_impl.hpp | 22 ++++++++--------- .../bindings/julia/get_printable_param.hpp | 22 ++++++++--------- .../bindings/julia/get_printable_type.hpp | 14 +++++------ .../julia/get_printable_type_impl.hpp | 14 +++++------ .../bindings/julia/print_type_doc_impl.hpp | 14 +++++------ 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/mlpack/bindings/julia/default_param.hpp b/src/mlpack/bindings/julia/default_param.hpp index 4c61cec7e6..fca7d4a488 100644 --- a/src/mlpack/bindings/julia/default_param.hpp +++ b/src/mlpack/bindings/julia/default_param.hpp @@ -26,12 +26,12 @@ namespace julia { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return the default value of a vector option. @@ -39,7 +39,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a string option. @@ -47,7 +47,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a matrix option, a tuple option, a @@ -57,10 +57,10 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */ = 0); + arma::mat>>::value>::type* = 0); /** * Return the default value of a model option (this returns the default @@ -69,8 +69,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Return the default value of an option. This is the function that will be diff --git a/src/mlpack/bindings/julia/default_param_impl.hpp b/src/mlpack/bindings/julia/default_param_impl.hpp index 9b975989e1..f1a71e7cf2 100644 --- a/src/mlpack/bindings/julia/default_param_impl.hpp +++ b/src/mlpack/bindings/julia/default_param_impl.hpp @@ -24,12 +24,12 @@ namespace julia { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type* /* junk */) { std::ostringstream oss; if (std::is_same::value) @@ -46,7 +46,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { // Print each element in an array delimited by square brackets. std::ostringstream oss; @@ -89,7 +89,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { const std::string& s = *boost::any_cast(&data.value); return "\"" + s + "\""; @@ -102,7 +102,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */) @@ -134,8 +134,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { return "nothing"; } diff --git a/src/mlpack/bindings/julia/get_printable_param.hpp b/src/mlpack/bindings/julia/get_printable_param.hpp index a7c241857e..f6e7e442bc 100644 --- a/src/mlpack/bindings/julia/get_printable_param.hpp +++ b/src/mlpack/bindings/julia/get_printable_param.hpp @@ -25,11 +25,11 @@ namespace julia { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { std::ostringstream oss; oss << boost::any_cast(data.value); @@ -42,7 +42,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const T& t = boost::any_cast(data.value); @@ -58,7 +58,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Get the matrix. const T& matrix = boost::any_cast(data.value); @@ -74,8 +74,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { std::ostringstream oss; oss << data.cppType << " model at " << boost::any_cast(data.value); @@ -88,8 +88,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // Get the matrix. const T& tuple = boost::any_cast(data.value); diff --git a/src/mlpack/bindings/julia/get_printable_type.hpp b/src/mlpack/bindings/julia/get_printable_type.hpp index 5d4a24c3ee..9fa2a03fec 100644 --- a/src/mlpack/bindings/julia/get_printable_type.hpp +++ b/src/mlpack/bindings/julia/get_printable_type.hpp @@ -23,11 +23,11 @@ namespace julia { template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return a string representing the command-line type of a vector. @@ -60,8 +60,8 @@ std::string GetPrintableType( template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print the command-line type of an option into a string. diff --git a/src/mlpack/bindings/julia/get_printable_type_impl.hpp b/src/mlpack/bindings/julia/get_printable_type_impl.hpp index f11c92dd8c..bbf32869b2 100644 --- a/src/mlpack/bindings/julia/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/julia/get_printable_type_impl.hpp @@ -26,11 +26,11 @@ namespace julia { template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { if (std::is_same::value) return "Bool"; @@ -102,8 +102,8 @@ std::string GetPrintableType( template std::string GetPrintableType( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { std::string type = util::StripType(data.cppType); if (type == "mlpackModel") diff --git a/src/mlpack/bindings/julia/print_type_doc_impl.hpp b/src/mlpack/bindings/julia/print_type_doc_impl.hpp index 7e6da1f606..6b72612f69 100644 --- a/src/mlpack/bindings/julia/print_type_doc_impl.hpp +++ b/src/mlpack/bindings/julia/print_type_doc_impl.hpp @@ -24,11 +24,11 @@ namespace julia { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { // A flag type. if (std::is_same::value) @@ -153,8 +153,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& /* data */, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "An mlpack model pointer. `` refers to the type of model that " "is being stored, so, e.g., for `CF()`, the type will be `CFModel`. " From 7e6dea54968857e68625708f7a73353f5ee28d83 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 26 Jun 2021 20:37:52 +0200 Subject: [PATCH 81/98] Ooops, a missing file Signed-off-by: Omar Shrit --- src/mlpack/bindings/julia/print_type_doc.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mlpack/bindings/julia/print_type_doc.hpp b/src/mlpack/bindings/julia/print_type_doc.hpp index 407fa3ee1d..eabda5a067 100644 --- a/src/mlpack/bindings/julia/print_type_doc.hpp +++ b/src/mlpack/bindings/julia/print_type_doc.hpp @@ -25,11 +25,11 @@ namespace julia { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return a string representing the command-line type of a vector. @@ -62,8 +62,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print the command-line type of an option into a string. From 863c5672e5a7f7c8272d15d752d8088a48293508 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 27 Jun 2021 16:29:36 +0200 Subject: [PATCH 82/98] Add the R bindings Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/default_param.hpp | 22 ++--- src/mlpack/bindings/R/default_param_impl.hpp | 22 ++--- src/mlpack/bindings/R/get_printable_param.hpp | 22 ++--- src/mlpack/bindings/R/get_printable_type.hpp | 84 +++++++++---------- .../bindings/R/get_printable_type_impl.hpp | 84 +++++++++---------- src/mlpack/bindings/R/get_r_type.hpp | 76 ++++++++--------- src/mlpack/bindings/R/get_type.hpp | 80 +++++++++--------- .../bindings/R/print_input_processing.hpp | 18 ++-- .../bindings/R/print_output_processing.hpp | 18 ++-- src/mlpack/bindings/R/print_type_doc.hpp | 20 ++--- src/mlpack/bindings/R/print_type_doc_impl.hpp | 20 ++--- 11 files changed, 233 insertions(+), 233 deletions(-) diff --git a/src/mlpack/bindings/R/default_param.hpp b/src/mlpack/bindings/R/default_param.hpp index 4d50eb16f5..8fdf41dfbf 100644 --- a/src/mlpack/bindings/R/default_param.hpp +++ b/src/mlpack/bindings/R/default_param.hpp @@ -26,12 +26,12 @@ namespace r { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return the default value of a vector option. @@ -39,7 +39,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a string option. @@ -47,7 +47,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a matrix option, a tuple option, a @@ -57,7 +57,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */ = 0); @@ -69,8 +69,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Return the default value of an option. This is the function that will be diff --git a/src/mlpack/bindings/R/default_param_impl.hpp b/src/mlpack/bindings/R/default_param_impl.hpp index de529d011a..751834baca 100644 --- a/src/mlpack/bindings/R/default_param_impl.hpp +++ b/src/mlpack/bindings/R/default_param_impl.hpp @@ -24,12 +24,12 @@ namespace r { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type* /* junk */) { std::ostringstream oss; if (std::is_same::value) @@ -46,7 +46,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { // Print each element in an array delimited by square brackets. std::ostringstream oss; @@ -89,7 +89,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { const std::string& s = *boost::any_cast(&data.value); return "\"" + s + "\""; @@ -102,7 +102,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */) @@ -132,8 +132,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { return "NA"; } diff --git a/src/mlpack/bindings/R/get_printable_param.hpp b/src/mlpack/bindings/R/get_printable_param.hpp index b76d62efa8..261d363642 100644 --- a/src/mlpack/bindings/R/get_printable_param.hpp +++ b/src/mlpack/bindings/R/get_printable_param.hpp @@ -25,11 +25,11 @@ namespace r { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { std::ostringstream oss; oss << boost::any_cast(data.value); @@ -42,7 +42,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const T& t = boost::any_cast(data.value); @@ -58,7 +58,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Get the matrix. const T& matrix = boost::any_cast(data.value); @@ -74,8 +74,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { std::ostringstream oss; oss << data.cppType << " model at " << boost::any_cast(data.value); @@ -88,8 +88,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // Get the matrix. const T& tuple = boost::any_cast(data.value); diff --git a/src/mlpack/bindings/R/get_printable_type.hpp b/src/mlpack/bindings/R/get_printable_type.hpp index 730422cade..4b19c21cdf 100644 --- a/src/mlpack/bindings/R/get_printable_type.hpp +++ b/src/mlpack/bindings/R/get_printable_type.hpp @@ -23,84 +23,84 @@ namespace r { template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template void GetPrintableType(util::ParamData& d, diff --git a/src/mlpack/bindings/R/get_printable_type_impl.hpp b/src/mlpack/bindings/R/get_printable_type_impl.hpp index cedecdf2ab..a163a615f5 100644 --- a/src/mlpack/bindings/R/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/R/get_printable_type_impl.hpp @@ -22,11 +22,11 @@ namespace r { template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "unknown"; } @@ -34,11 +34,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "integer"; } @@ -46,11 +46,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "numeric"; } @@ -58,11 +58,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "character"; } @@ -70,11 +70,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "integer"; } @@ -82,11 +82,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "logical"; } @@ -94,9 +94,9 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "vector of " + GetPrintableType(d) + "s"; } @@ -104,9 +104,9 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { std::string type = "numeric matrix"; if (std::is_same::value) @@ -127,8 +127,8 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>>::type*) + const typename std::enable_if>::value>::type*) { return "categorical matrix/data.frame"; } @@ -136,10 +136,10 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { std::string type = util::StripType(d.cppType); if (type == "mlpackModel") diff --git a/src/mlpack/bindings/R/get_r_type.hpp b/src/mlpack/bindings/R/get_r_type.hpp index a32995dbca..d01559ea66 100644 --- a/src/mlpack/bindings/R/get_r_type.hpp +++ b/src/mlpack/bindings/R/get_r_type.hpp @@ -23,11 +23,11 @@ namespace r { template inline std::string GetRType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { return "unknown"; } @@ -35,11 +35,11 @@ inline std::string GetRType( template<> inline std::string GetRType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "logical"; } @@ -47,11 +47,11 @@ inline std::string GetRType( template<> inline std::string GetRType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "integer"; } @@ -59,11 +59,11 @@ inline std::string GetRType( template<> inline std::string GetRType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "integer"; } @@ -71,11 +71,11 @@ inline std::string GetRType( template<> inline std::string GetRType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "numeric"; } @@ -83,11 +83,11 @@ inline std::string GetRType( template<> inline std::string GetRType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "character"; } @@ -95,7 +95,7 @@ inline std::string GetRType( template inline std::string GetRType( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { return GetRType(d) + " vector"; } @@ -103,9 +103,9 @@ inline std::string GetRType( template inline std::string GetRType( util::ParamData& d, - const typename boost::disable_if>>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if>::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { std::string elemType = GetRType(d); std::string type = "matrix"; @@ -120,8 +120,8 @@ inline std::string GetRType( template inline std::string GetRType( util::ParamData& /* d */, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { return "numeric matrix/data.frame with info"; } @@ -129,8 +129,8 @@ inline std::string GetRType( template inline std::string GetRType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return util::StripType(d.cppType); } diff --git a/src/mlpack/bindings/R/get_type.hpp b/src/mlpack/bindings/R/get_type.hpp index 0437fefab0..574ec6674c 100644 --- a/src/mlpack/bindings/R/get_type.hpp +++ b/src/mlpack/bindings/R/get_type.hpp @@ -24,11 +24,11 @@ namespace r { template inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { return "unknown"; } @@ -36,11 +36,11 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "Int"; } @@ -48,11 +48,11 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "Float"; } @@ -60,11 +60,11 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "Double"; } @@ -72,11 +72,11 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "String"; } @@ -84,11 +84,11 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "Bool"; } @@ -96,9 +96,9 @@ inline std::string GetType( template inline std::string GetType( util::ParamData& d, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { return "Vec" + GetType(d); } @@ -106,9 +106,9 @@ inline std::string GetType( template inline std::string GetType( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { std::string type = ""; if (std::is_same::value) @@ -136,8 +136,8 @@ inline std::string GetType( template inline std::string GetType( util::ParamData& /* d */, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { return "MatWithInfo"; } @@ -145,8 +145,8 @@ inline std::string GetType( template inline std::string GetType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return d.cppType; } diff --git a/src/mlpack/bindings/R/print_input_processing.hpp b/src/mlpack/bindings/R/print_input_processing.hpp index 4565a6d503..34d10d5b1a 100644 --- a/src/mlpack/bindings/R/print_input_processing.hpp +++ b/src/mlpack/bindings/R/print_input_processing.hpp @@ -26,10 +26,10 @@ namespace r { template void PrintInputProcessing( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { if (!d.required) { @@ -72,7 +72,7 @@ void PrintInputProcessing( template void PrintInputProcessing( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { if (!d.required) { @@ -108,8 +108,8 @@ void PrintInputProcessing( template void PrintInputProcessing( util::ParamData& d, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { if (!d.required) { @@ -155,8 +155,8 @@ void PrintInputProcessing( template void PrintInputProcessing( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { if (!d.required) { diff --git a/src/mlpack/bindings/R/print_output_processing.hpp b/src/mlpack/bindings/R/print_output_processing.hpp index 3345f6e437..77c6e4451c 100644 --- a/src/mlpack/bindings/R/print_output_processing.hpp +++ b/src/mlpack/bindings/R/print_output_processing.hpp @@ -26,10 +26,10 @@ namespace r { template void PrintOutputProcessing( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { /** * This gives us code like: @@ -48,7 +48,7 @@ void PrintOutputProcessing( template void PrintOutputProcessing( util::ParamData& d, - const typename boost::enable_if>::type* = 0, + const typename std::enable_if::value>::type* = 0, const typename std::enable_if>::value>::type* = 0) { @@ -69,8 +69,8 @@ void PrintOutputProcessing( template void PrintOutputProcessing( util::ParamData& d, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { /** * This gives us code like: @@ -89,8 +89,8 @@ void PrintOutputProcessing( template void PrintOutputProcessing( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { /** * This gives us code like: diff --git a/src/mlpack/bindings/R/print_type_doc.hpp b/src/mlpack/bindings/R/print_type_doc.hpp index c6b37ce1e4..92bbd07dbe 100644 --- a/src/mlpack/bindings/R/print_type_doc.hpp +++ b/src/mlpack/bindings/R/print_type_doc.hpp @@ -25,11 +25,11 @@ namespace r { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return a string representing the command-line type of a vector. @@ -37,7 +37,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value>::type* = 0); + const typename std::enable_if::value::value>::type* = 0); /** * Return a string representing the command-line type of a matrix option. @@ -45,7 +45,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value>::type* = 0); + const typename std::enable_if::value::value>::type* = 0); /** * Return a string representing the command-line type of a matrix tuple option. @@ -54,7 +54,7 @@ template std::string PrintTypeDoc( util::ParamData& data, const typename std::enable_if>::value>::type* = 0); + std::tuple>::value::value>::type* = 0); /** * Return a string representing the command-line type of a model. @@ -62,8 +62,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print the command-line type of an option into a string. diff --git a/src/mlpack/bindings/R/print_type_doc_impl.hpp b/src/mlpack/bindings/R/print_type_doc_impl.hpp index b2b87bdbdd..79c03bed48 100644 --- a/src/mlpack/bindings/R/print_type_doc_impl.hpp +++ b/src/mlpack/bindings/R/print_type_doc_impl.hpp @@ -24,11 +24,11 @@ namespace r { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { // A flag type. if (std::is_same::value) @@ -64,7 +64,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value>::type*) + const typename std::enable_if::value::value>::type*) { if (std::is_same>::value) { @@ -86,7 +86,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value>::type*) + const typename std::enable_if::value::value>::type*) { if (std::is_same::value) { @@ -129,7 +129,7 @@ template std::string PrintTypeDoc( util::ParamData& /* data */, const typename std::enable_if>::value>::type*) + std::tuple>::value::value>::type*) { return "A 2-d array containing `numeric` data. Like the regular 2-d matrices" ", this can be a `matrix`, or a `data.frame`. However, this type can also" @@ -146,8 +146,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& /* data */, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "An mlpack model pointer. `` refers to the type of model that " "is being stored, so, e.g., for `cf()`, the type will be `CFModel`. " From fe7bfbbb789b9fe14be35822ea674fe875eb0c2c Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 27 Jun 2021 16:57:27 +0200 Subject: [PATCH 83/98] Python Binding now... Signed-off-by: Omar Shrit --- src/mlpack/bindings/python/default_param.hpp | 24 +++--- .../bindings/python/default_param_impl.hpp | 22 ++--- .../bindings/python/get_cython_type.hpp | 44 +++++----- .../bindings/python/get_printable_param.hpp | 22 ++--- .../bindings/python/get_printable_type.hpp | 84 +++++++++---------- .../python/get_printable_type_impl.hpp | 84 +++++++++---------- src/mlpack/bindings/python/import_decl.hpp | 10 +-- .../bindings/python/print_class_defn.hpp | 10 +-- .../python/print_input_processing.hpp | 36 ++++---- .../python/print_output_processing.hpp | 18 ++-- src/mlpack/bindings/python/print_type_doc.hpp | 14 ++-- .../bindings/python/print_type_doc_impl.hpp | 14 ++-- 12 files changed, 191 insertions(+), 191 deletions(-) diff --git a/src/mlpack/bindings/python/default_param.hpp b/src/mlpack/bindings/python/default_param.hpp index 15504a74b4..36a6b19c32 100644 --- a/src/mlpack/bindings/python/default_param.hpp +++ b/src/mlpack/bindings/python/default_param.hpp @@ -26,12 +26,12 @@ namespace python { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return the default value of a vector option. @@ -39,7 +39,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a string option. @@ -47,7 +47,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a matrix option, a tuple option, a @@ -57,10 +57,10 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */ = 0); + arma::mat>>::value>::type* = 0); /** * Return the default value of a model option (this returns the default @@ -69,8 +69,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Return the default value of an option. This is the function that will be diff --git a/src/mlpack/bindings/python/default_param_impl.hpp b/src/mlpack/bindings/python/default_param_impl.hpp index 15c7f344ae..d953c2efb2 100644 --- a/src/mlpack/bindings/python/default_param_impl.hpp +++ b/src/mlpack/bindings/python/default_param_impl.hpp @@ -24,12 +24,12 @@ namespace python { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type* /* junk */) { std::ostringstream oss; if (std::is_same::value) @@ -46,7 +46,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { // Print each element in an array delimited by square brackets. std::ostringstream oss; @@ -89,7 +89,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { const std::string& s = *boost::any_cast(&data.value); return "'" + s + "'"; @@ -102,7 +102,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */) @@ -134,8 +134,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { return "None"; } diff --git a/src/mlpack/bindings/python/get_cython_type.hpp b/src/mlpack/bindings/python/get_cython_type.hpp index bb01da538e..705b785758 100644 --- a/src/mlpack/bindings/python/get_cython_type.hpp +++ b/src/mlpack/bindings/python/get_cython_type.hpp @@ -23,9 +23,9 @@ namespace python { template inline std::string GetCythonType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return "unknown"; } @@ -33,9 +33,9 @@ inline std::string GetCythonType( template<> inline std::string GetCythonType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "int"; } @@ -43,9 +43,9 @@ inline std::string GetCythonType( template<> inline std::string GetCythonType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "double"; } @@ -53,9 +53,9 @@ inline std::string GetCythonType( template<> inline std::string GetCythonType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "string"; } @@ -63,9 +63,9 @@ inline std::string GetCythonType( template<> inline std::string GetCythonType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "size_t"; } @@ -73,9 +73,9 @@ inline std::string GetCythonType( template<> inline std::string GetCythonType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "cbool"; } @@ -83,7 +83,7 @@ inline std::string GetCythonType( template inline std::string GetCythonType( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { return "vector[" + GetCythonType(d) + "]"; } @@ -91,7 +91,7 @@ inline std::string GetCythonType( template inline std::string GetCythonType( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { std::string type = "Mat"; if (T::is_row) @@ -105,8 +105,8 @@ inline std::string GetCythonType( template inline std::string GetCythonType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return d.cppType + "*"; } diff --git a/src/mlpack/bindings/python/get_printable_param.hpp b/src/mlpack/bindings/python/get_printable_param.hpp index effdf4f07b..44ab825687 100644 --- a/src/mlpack/bindings/python/get_printable_param.hpp +++ b/src/mlpack/bindings/python/get_printable_param.hpp @@ -25,11 +25,11 @@ namespace python { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { std::ostringstream oss; oss << boost::any_cast(data.value); @@ -42,7 +42,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const T& t = boost::any_cast(data.value); @@ -58,7 +58,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Get the matrix. const T& matrix = boost::any_cast(data.value); @@ -74,8 +74,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { std::ostringstream oss; oss << data.cppType << " model at " << boost::any_cast(data.value); @@ -88,8 +88,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // Get the matrix. const T& tuple = boost::any_cast(data.value); diff --git a/src/mlpack/bindings/python/get_printable_type.hpp b/src/mlpack/bindings/python/get_printable_type.hpp index 2b7cfb40ed..41593e4681 100644 --- a/src/mlpack/bindings/python/get_printable_type.hpp +++ b/src/mlpack/bindings/python/get_printable_type.hpp @@ -23,84 +23,84 @@ namespace python { template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template void GetPrintableType(util::ParamData& d, diff --git a/src/mlpack/bindings/python/get_printable_type_impl.hpp b/src/mlpack/bindings/python/get_printable_type_impl.hpp index 0181079aa1..9494065b4b 100644 --- a/src/mlpack/bindings/python/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/python/get_printable_type_impl.hpp @@ -22,11 +22,11 @@ namespace python { template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "unknown"; } @@ -34,11 +34,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "int"; } @@ -46,11 +46,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "float"; } @@ -58,11 +58,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "str"; } @@ -70,11 +70,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "int"; } @@ -82,11 +82,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "bool"; } @@ -94,9 +94,9 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "list of " + GetPrintableType(d) + "s"; } @@ -104,9 +104,9 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { std::string type = "matrix"; if (std::is_same::value) @@ -127,8 +127,8 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>>::type*) + const typename std::enable_if>::value>::type*) { return "categorical matrix"; } @@ -136,10 +136,10 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return d.cppType + "Type"; } diff --git a/src/mlpack/bindings/python/import_decl.hpp b/src/mlpack/bindings/python/import_decl.hpp index b060a66dfe..e6518ce461 100644 --- a/src/mlpack/bindings/python/import_decl.hpp +++ b/src/mlpack/bindings/python/import_decl.hpp @@ -26,8 +26,8 @@ template void ImportDecl( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // First, we have to parse the type. If we have something like, e.g., // 'LogisticRegression<>', we must convert this to 'LogisticRegression[T=*].' @@ -53,8 +53,8 @@ template void ImportDecl( util::ParamData& /* d */, const size_t /* indent */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Print nothing. } @@ -66,7 +66,7 @@ template void ImportDecl( util::ParamData& /* d */, const size_t /* indent */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Print nothing. } diff --git a/src/mlpack/bindings/python/print_class_defn.hpp b/src/mlpack/bindings/python/print_class_defn.hpp index ff1de4b26e..53d07d11e7 100644 --- a/src/mlpack/bindings/python/print_class_defn.hpp +++ b/src/mlpack/bindings/python/print_class_defn.hpp @@ -25,8 +25,8 @@ namespace python { template void PrintClassDefn( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Do nothing. } @@ -37,7 +37,7 @@ void PrintClassDefn( template void PrintClassDefn( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Do nothing. } @@ -48,8 +48,8 @@ void PrintClassDefn( template void PrintClassDefn( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // First, we have to parse the type. If we have something like, e.g., // 'LogisticRegression<>', we must convert this to 'LogisticRegression[].' diff --git a/src/mlpack/bindings/python/print_input_processing.hpp b/src/mlpack/bindings/python/print_input_processing.hpp index c4a8ed5006..5137db40e9 100644 --- a/src/mlpack/bindings/python/print_input_processing.hpp +++ b/src/mlpack/bindings/python/print_input_processing.hpp @@ -31,11 +31,11 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { // The copy_all_inputs parameter must be handled first, and therefore is // outside the scope of this code. @@ -164,11 +164,11 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -251,8 +251,8 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -372,9 +372,9 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // First, get the correct class name if needed. std::string strippedType, printedType, defaultsType; @@ -445,9 +445,9 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { // The user should pass in a matrix type of some sort. const std::string prefix(indent, ' '); diff --git a/src/mlpack/bindings/python/print_output_processing.hpp b/src/mlpack/bindings/python/print_output_processing.hpp index af1ef95a93..e9c89200b3 100644 --- a/src/mlpack/bindings/python/print_output_processing.hpp +++ b/src/mlpack/bindings/python/print_output_processing.hpp @@ -30,10 +30,10 @@ void PrintOutputProcessing( util::ParamData& d, const size_t indent, const bool onlyOutput, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -86,7 +86,7 @@ void PrintOutputProcessing( util::ParamData& d, const size_t indent, const bool onlyOutput, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -128,8 +128,8 @@ void PrintOutputProcessing( util::ParamData& d, const size_t indent, const bool onlyOutput, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -170,8 +170,8 @@ void PrintOutputProcessing( util::ParamData& d, const size_t indent, const bool onlyOutput, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Get the type names we need to use. std::string strippedType, printedType, defaultsType; diff --git a/src/mlpack/bindings/python/print_type_doc.hpp b/src/mlpack/bindings/python/print_type_doc.hpp index 88186faafb..aad90ee4b7 100644 --- a/src/mlpack/bindings/python/print_type_doc.hpp +++ b/src/mlpack/bindings/python/print_type_doc.hpp @@ -25,11 +25,11 @@ namespace python { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return a string representing the command-line type of a vector. @@ -62,8 +62,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print the command-line type of an option into a string. diff --git a/src/mlpack/bindings/python/print_type_doc_impl.hpp b/src/mlpack/bindings/python/print_type_doc_impl.hpp index 8ab5986721..64b6ca3e22 100644 --- a/src/mlpack/bindings/python/print_type_doc_impl.hpp +++ b/src/mlpack/bindings/python/print_type_doc_impl.hpp @@ -24,11 +24,11 @@ namespace python { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { // A flag type. if (std::is_same::value) @@ -150,8 +150,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& /* data */, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "An mlpack model pointer. This type can be pickled to or from disk, " "and internally holds a pointer to C++ memory containing the mlpack " From c6e76d5919d84b3dc50ccc68367dd00f6a9eb409 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 27 Jun 2021 17:20:27 +0200 Subject: [PATCH 84/98] GO also, could not check it locally, hard to install gonum Signed-off-by: Omar Shrit --- src/mlpack/bindings/go/default_param.hpp | 24 +++--- src/mlpack/bindings/go/default_param_impl.hpp | 22 +++--- src/mlpack/bindings/go/get_go_type.hpp | 76 +++++++++---------- .../bindings/go/get_printable_param.hpp | 22 +++--- src/mlpack/bindings/go/get_printable_type.hpp | 74 +++++++++--------- .../bindings/go/get_printable_type_impl.hpp | 74 +++++++++--------- src/mlpack/bindings/go/get_type.hpp | 44 +++++------ src/mlpack/bindings/go/print_defn_input.hpp | 18 ++--- src/mlpack/bindings/go/print_defn_output.hpp | 18 ++--- .../bindings/go/print_input_processing.hpp | 18 ++--- .../bindings/go/print_method_config.hpp | 18 ++--- src/mlpack/bindings/go/print_method_init.hpp | 18 ++--- .../bindings/go/print_output_processing.hpp | 18 ++--- src/mlpack/bindings/go/print_type_doc.hpp | 14 ++-- .../bindings/go/print_type_doc_impl.hpp | 14 ++-- 15 files changed, 236 insertions(+), 236 deletions(-) diff --git a/src/mlpack/bindings/go/default_param.hpp b/src/mlpack/bindings/go/default_param.hpp index 7469b30ac3..4b967b270e 100644 --- a/src/mlpack/bindings/go/default_param.hpp +++ b/src/mlpack/bindings/go/default_param.hpp @@ -26,12 +26,12 @@ namespace go { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return the default value of a vector option. @@ -39,7 +39,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a string option. @@ -47,7 +47,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return the default value of a matrix option, a tuple option, a @@ -57,10 +57,10 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */ = 0); + arma::mat>>::value>::type* = 0); /** * Return the default value of a model option (this returns the default @@ -69,8 +69,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Return the default value of an option. This is the function that will be diff --git a/src/mlpack/bindings/go/default_param_impl.hpp b/src/mlpack/bindings/go/default_param_impl.hpp index e3a9a07103..4d3c0feca1 100644 --- a/src/mlpack/bindings/go/default_param_impl.hpp +++ b/src/mlpack/bindings/go/default_param_impl.hpp @@ -24,12 +24,12 @@ namespace go { template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type* /* junk */) { std::ostringstream oss; if (std::is_same::value) @@ -46,7 +46,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { // Print each element in an array delimited by square brackets. std::ostringstream oss; @@ -90,7 +90,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& data, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*) { const std::string& s = *boost::any_cast(&data.value); return "\"" + s + "\""; @@ -102,7 +102,7 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::enable_if_c< + const typename std::enable_if< arma::is_arma_type::value || std::is_same>::value>::type* /* junk */) @@ -134,8 +134,8 @@ std::string DefaultParamImpl( template std::string DefaultParamImpl( util::ParamData& /* data */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { return "nil"; } diff --git a/src/mlpack/bindings/go/get_go_type.hpp b/src/mlpack/bindings/go/get_go_type.hpp index 77c851cb99..55bafb2ddb 100644 --- a/src/mlpack/bindings/go/get_go_type.hpp +++ b/src/mlpack/bindings/go/get_go_type.hpp @@ -25,11 +25,11 @@ namespace go { template inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { return "unknown"; } @@ -37,11 +37,11 @@ inline std::string GetGoType( template<> inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "int"; } @@ -49,11 +49,11 @@ inline std::string GetGoType( template<> inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "float32"; } @@ -61,11 +61,11 @@ inline std::string GetGoType( template<> inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "float64"; } @@ -73,11 +73,11 @@ inline std::string GetGoType( template<> inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "string"; } @@ -85,11 +85,11 @@ inline std::string GetGoType( template<> inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "bool"; } @@ -97,7 +97,7 @@ inline std::string GetGoType( template inline std::string GetGoType( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { return "[]" + GetGoType(d); } @@ -105,9 +105,9 @@ inline std::string GetGoType( template inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::disable_if>>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if>::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return "mat.Dense"; } @@ -115,8 +115,8 @@ inline std::string GetGoType( template inline std::string GetGoType( util::ParamData& /* d */, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { return "matrixWithInfo"; } @@ -124,8 +124,8 @@ inline std::string GetGoType( template inline std::string GetGoType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { std::string goStrippedType, strippedType, printedType, defaultsType; StripType(d.cppType, goStrippedType, strippedType, printedType, defaultsType); diff --git a/src/mlpack/bindings/go/get_printable_param.hpp b/src/mlpack/bindings/go/get_printable_param.hpp index 90e5f74590..091bfcba80 100644 --- a/src/mlpack/bindings/go/get_printable_param.hpp +++ b/src/mlpack/bindings/go/get_printable_param.hpp @@ -25,11 +25,11 @@ namespace go { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { std::ostringstream oss; oss << boost::any_cast(data.value); @@ -42,7 +42,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const T& t = boost::any_cast(data.value); @@ -58,7 +58,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Get the matrix. const T& matrix = boost::any_cast(data.value); @@ -74,8 +74,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { std::ostringstream oss; oss << data.cppType << " model at " << boost::any_cast(data.value); @@ -88,8 +88,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // Get the matrix. const T& tuple = boost::any_cast(data.value); diff --git a/src/mlpack/bindings/go/get_printable_type.hpp b/src/mlpack/bindings/go/get_printable_type.hpp index 014fcad297..b16533da18 100644 --- a/src/mlpack/bindings/go/get_printable_type.hpp +++ b/src/mlpack/bindings/go/get_printable_type.hpp @@ -23,75 +23,75 @@ namespace go { template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*); + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*); template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); template void GetPrintableType(util::ParamData& d, diff --git a/src/mlpack/bindings/go/get_printable_type_impl.hpp b/src/mlpack/bindings/go/get_printable_type_impl.hpp index da4df3bec9..921f5f53a1 100644 --- a/src/mlpack/bindings/go/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/go/get_printable_type_impl.hpp @@ -23,11 +23,11 @@ namespace go { template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "unknown"; } @@ -35,11 +35,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "int"; } @@ -47,11 +47,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "float64"; } @@ -59,11 +59,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "string"; } @@ -71,11 +71,11 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "bool"; } @@ -83,9 +83,9 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { return "array of " + GetPrintableType(d) + "s"; } @@ -93,9 +93,9 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { std::string type = "*mat.Dense"; if (T::is_row || T::is_col) @@ -107,8 +107,8 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& /* d */, - const typename boost::enable_if>>::type*) + const typename std::enable_if>::value>::type*) { return "matrixWithInfo"; } @@ -116,10 +116,10 @@ inline std::string GetPrintableType( template inline std::string GetPrintableType( util::ParamData& d, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { std::string goStrippedType, strippedType, printedType, defaultsType; StripType(d.cppType, goStrippedType, strippedType, printedType, defaultsType); diff --git a/src/mlpack/bindings/go/get_type.hpp b/src/mlpack/bindings/go/get_type.hpp index c46c87651d..0a1417ccab 100644 --- a/src/mlpack/bindings/go/get_type.hpp +++ b/src/mlpack/bindings/go/get_type.hpp @@ -24,9 +24,9 @@ namespace go { template inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return "unknown"; } @@ -34,9 +34,9 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "Int"; } @@ -44,9 +44,9 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "Float"; } @@ -54,9 +54,9 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "Double"; } @@ -64,9 +64,9 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "String"; } @@ -74,9 +74,9 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "Bool"; } @@ -84,7 +84,7 @@ inline std::string GetType( template inline std::string GetType( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { return "Vec" + GetType(d); } @@ -92,7 +92,7 @@ inline std::string GetType( template inline std::string GetType( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { std::string type = ""; if (std::is_same::value) @@ -120,8 +120,8 @@ inline std::string GetType( template inline std::string GetType( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return d.cppType + "*"; } diff --git a/src/mlpack/bindings/go/print_defn_input.hpp b/src/mlpack/bindings/go/print_defn_input.hpp index 5ae6662a97..c51dfa110b 100644 --- a/src/mlpack/bindings/go/print_defn_input.hpp +++ b/src/mlpack/bindings/go/print_defn_input.hpp @@ -28,10 +28,10 @@ namespace go { template void PrintDefnInput( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { if (d.required) { @@ -46,7 +46,7 @@ void PrintDefnInput( template void PrintDefnInput( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // param_name *mat.Dense if (d.required) @@ -62,8 +62,8 @@ void PrintDefnInput( template void PrintDefnInput( util::ParamData& d, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // param_name *DataWithInfo if (d.required) @@ -79,8 +79,8 @@ void PrintDefnInput( template void PrintDefnInput( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Get the type names we need to use. std::string goStrippedType, strippedType, printedType, defaultsType; diff --git a/src/mlpack/bindings/go/print_defn_output.hpp b/src/mlpack/bindings/go/print_defn_output.hpp index fa70517f10..b18233d1d0 100644 --- a/src/mlpack/bindings/go/print_defn_output.hpp +++ b/src/mlpack/bindings/go/print_defn_output.hpp @@ -27,10 +27,10 @@ namespace go { template void PrintDefnOutput( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { std::cout << GetGoType(d); } @@ -41,7 +41,7 @@ void PrintDefnOutput( template void PrintDefnOutput( util::ParamData& d, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // *mat.Dense std::cout << "*" << GetGoType(d); @@ -53,8 +53,8 @@ void PrintDefnOutput( template void PrintDefnOutput( util::ParamData& d, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { // *mat.Dense std::cout << "*" << GetGoType(d); @@ -66,8 +66,8 @@ void PrintDefnOutput( template void PrintDefnOutput( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Get the type names we need to use. std::string goStrippedType, strippedType, printedType, defaultsType; diff --git a/src/mlpack/bindings/go/print_input_processing.hpp b/src/mlpack/bindings/go/print_input_processing.hpp index 99b0f9a9ed..8b6fa77eea 100644 --- a/src/mlpack/bindings/go/print_input_processing.hpp +++ b/src/mlpack/bindings/go/print_input_processing.hpp @@ -29,10 +29,10 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -129,7 +129,7 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -189,8 +189,8 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -250,8 +250,8 @@ template void PrintInputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // First, get the correct classparamName if needed. std::string goStrippedType, strippedType, printedType, defaultsType; diff --git a/src/mlpack/bindings/go/print_method_config.hpp b/src/mlpack/bindings/go/print_method_config.hpp index b4be743d1a..6a51d7205d 100644 --- a/src/mlpack/bindings/go/print_method_config.hpp +++ b/src/mlpack/bindings/go/print_method_config.hpp @@ -29,10 +29,10 @@ template void PrintMethodConfig( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -64,7 +64,7 @@ template void PrintMethodConfig( util::ParamData& d, const size_t indent, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -96,8 +96,8 @@ template void PrintMethodConfig( util::ParamData& d, const size_t indent, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -129,8 +129,8 @@ template void PrintMethodConfig( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); diff --git a/src/mlpack/bindings/go/print_method_init.hpp b/src/mlpack/bindings/go/print_method_init.hpp index f1877f48ff..1a9a363c48 100644 --- a/src/mlpack/bindings/go/print_method_init.hpp +++ b/src/mlpack/bindings/go/print_method_init.hpp @@ -29,10 +29,10 @@ template void PrintMethodInit( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -86,7 +86,7 @@ template void PrintMethodInit( util::ParamData& d, const size_t indent, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -118,8 +118,8 @@ template void PrintMethodInit( util::ParamData& d, const size_t indent, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -151,8 +151,8 @@ template void PrintMethodInit( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { const std::string prefix(indent, ' '); diff --git a/src/mlpack/bindings/go/print_output_processing.hpp b/src/mlpack/bindings/go/print_output_processing.hpp index 5a5c77fa74..46cec80184 100644 --- a/src/mlpack/bindings/go/print_output_processing.hpp +++ b/src/mlpack/bindings/go/print_output_processing.hpp @@ -29,10 +29,10 @@ template void PrintOutputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -56,7 +56,7 @@ template void PrintOutputProcessing( util::ParamData& d, const size_t indent, - const typename boost::enable_if>::type* = 0, + const typename std::enable_if::value>::type* = 0, const typename std::enable_if>::value>::type* = 0) { @@ -83,8 +83,8 @@ template void PrintOutputProcessing( util::ParamData& d, const size_t indent, - const typename boost::enable_if>>::type* = 0) + const typename std::enable_if>::value>::type* = 0) { const std::string prefix(indent, ' '); @@ -109,8 +109,8 @@ template void PrintOutputProcessing( util::ParamData& d, const size_t indent, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Get the type names we need to use. std::string goStrippedType, strippedType, printedType, defaultsType; diff --git a/src/mlpack/bindings/go/print_type_doc.hpp b/src/mlpack/bindings/go/print_type_doc.hpp index 2da51fbb67..b5dde90fa0 100644 --- a/src/mlpack/bindings/go/print_type_doc.hpp +++ b/src/mlpack/bindings/go/print_type_doc.hpp @@ -25,11 +25,11 @@ namespace go { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Return a string representing the command-line type of a vector. @@ -62,8 +62,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print the command-line type of an option into a string. diff --git a/src/mlpack/bindings/go/print_type_doc_impl.hpp b/src/mlpack/bindings/go/print_type_doc_impl.hpp index d0a5fef659..568ef9b059 100644 --- a/src/mlpack/bindings/go/print_type_doc_impl.hpp +++ b/src/mlpack/bindings/go/print_type_doc_impl.hpp @@ -24,11 +24,11 @@ namespace go { template std::string PrintTypeDoc( util::ParamData& data, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>::type*, - const typename boost::disable_if>>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, + const typename std::enable_if>::value>::type*) { // A flag type. if (std::is_same::value) @@ -122,8 +122,8 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& /* data */, - const typename boost::disable_if>::type*, - const typename boost::enable_if>::type*) + const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*) { return "An mlpack model pointer. This type holds a pointer to C++ memory " "containing the mlpack model. Note that this means the mlpack model " From 3c7d044227c5bf455853c33fd9ecb3bca988206e Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 27 Jun 2021 17:22:17 +0200 Subject: [PATCH 85/98] Fix value::value, even if it has passed the tests Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/print_type_doc.hpp | 6 +++--- src/mlpack/bindings/R/print_type_doc_impl.hpp | 6 +++--- src/mlpack/bindings/cli/set_param.hpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mlpack/bindings/R/print_type_doc.hpp b/src/mlpack/bindings/R/print_type_doc.hpp index 92bbd07dbe..5f0253578b 100644 --- a/src/mlpack/bindings/R/print_type_doc.hpp +++ b/src/mlpack/bindings/R/print_type_doc.hpp @@ -37,7 +37,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value::value>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return a string representing the command-line type of a matrix option. @@ -45,7 +45,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value::value>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Return a string representing the command-line type of a matrix tuple option. @@ -54,7 +54,7 @@ template std::string PrintTypeDoc( util::ParamData& data, const typename std::enable_if>::value::value>::type* = 0); + std::tuple>::value>::type* = 0); /** * Return a string representing the command-line type of a model. diff --git a/src/mlpack/bindings/R/print_type_doc_impl.hpp b/src/mlpack/bindings/R/print_type_doc_impl.hpp index 79c03bed48..bc8ba85f25 100644 --- a/src/mlpack/bindings/R/print_type_doc_impl.hpp +++ b/src/mlpack/bindings/R/print_type_doc_impl.hpp @@ -64,7 +64,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value::value>::type*) + const typename std::enable_if::value>::type*) { if (std::is_same>::value) { @@ -86,7 +86,7 @@ std::string PrintTypeDoc( template std::string PrintTypeDoc( util::ParamData& data, - const typename std::enable_if::value::value>::type*) + const typename std::enable_if::value>::type*) { if (std::is_same::value) { @@ -129,7 +129,7 @@ template std::string PrintTypeDoc( util::ParamData& /* data */, const typename std::enable_if>::value::value>::type*) + std::tuple>::value>::type*) { return "A 2-d array containing `numeric` data. Like the regular 2-d matrices" ", this can be a `matrix`, or a `data.frame`. However, this type can also" diff --git a/src/mlpack/bindings/cli/set_param.hpp b/src/mlpack/bindings/cli/set_param.hpp index f76f058d2e..8fab3e0fb0 100644 --- a/src/mlpack/bindings/cli/set_param.hpp +++ b/src/mlpack/bindings/cli/set_param.hpp @@ -60,7 +60,7 @@ void SetParam( const boost::any& value, const typename std::enable_if::value || std::is_same>::value::value>::type* = 0) + std::tuple>::value>::type* = 0) { // We're setting the string filename. typedef std::tuple::type> TupleType; From dc28faa8b44397653976e8e384f5bf3d99562040 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 27 Jun 2021 17:25:23 +0200 Subject: [PATCH 86/98] Finish with tests Signed-off-by: Omar Shrit --- .../tests/delete_allocated_memory.hpp | 10 ++++----- .../bindings/tests/get_allocated_memory.hpp | 10 ++++----- .../bindings/tests/get_printable_param.hpp | 22 +++++++++---------- .../tests/get_printable_param_impl.hpp | 22 +++++++++---------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/mlpack/bindings/tests/delete_allocated_memory.hpp b/src/mlpack/bindings/tests/delete_allocated_memory.hpp index 08f59d74e8..5dd60fa294 100644 --- a/src/mlpack/bindings/tests/delete_allocated_memory.hpp +++ b/src/mlpack/bindings/tests/delete_allocated_memory.hpp @@ -21,8 +21,8 @@ namespace tests { template void DeleteAllocatedMemoryImpl( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Do nothing. } @@ -30,7 +30,7 @@ void DeleteAllocatedMemoryImpl( template void DeleteAllocatedMemoryImpl( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { // Do nothing. } @@ -38,8 +38,8 @@ void DeleteAllocatedMemoryImpl( template void DeleteAllocatedMemoryImpl( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Delete the allocated memory (hopefully we actually own it). delete *boost::any_cast(&d.value); diff --git a/src/mlpack/bindings/tests/get_allocated_memory.hpp b/src/mlpack/bindings/tests/get_allocated_memory.hpp index 579dbfdc8e..fb4a903b80 100644 --- a/src/mlpack/bindings/tests/get_allocated_memory.hpp +++ b/src/mlpack/bindings/tests/get_allocated_memory.hpp @@ -22,8 +22,8 @@ namespace tests { template void* GetAllocatedMemory( util::ParamData& /* d */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { return NULL; } @@ -31,7 +31,7 @@ void* GetAllocatedMemory( template void* GetAllocatedMemory( util::ParamData& /* d */, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0) { return NULL; } @@ -39,8 +39,8 @@ void* GetAllocatedMemory( template void* GetAllocatedMemory( util::ParamData& d, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0) { // Here we have a model; return its memory location. return *boost::any_cast(&d.value); diff --git a/src/mlpack/bindings/tests/get_printable_param.hpp b/src/mlpack/bindings/tests/get_printable_param.hpp index 556c28bd2f..0bf5e2ff24 100644 --- a/src/mlpack/bindings/tests/get_printable_param.hpp +++ b/src/mlpack/bindings/tests/get_printable_param.hpp @@ -27,11 +27,11 @@ namespace tests { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0); /** * Print a vector option, with spaces between it. @@ -39,7 +39,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Print a matrix option (this just prints the filename). @@ -47,7 +47,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0); /** * Print a serializable class option (this just prints the filename). @@ -55,8 +55,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* = 0, - const typename boost::enable_if>::type* = 0); + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0); /** * Print a mapped matrix option (this just prints the filename). @@ -64,8 +64,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>>::type* = 0); + const typename std::enable_if>::value>::type* = 0); /** * Print an option into a std::string. This should print a short, one-line diff --git a/src/mlpack/bindings/tests/get_printable_param_impl.hpp b/src/mlpack/bindings/tests/get_printable_param_impl.hpp index c14d8a4bed..3a6c604b69 100644 --- a/src/mlpack/bindings/tests/get_printable_param_impl.hpp +++ b/src/mlpack/bindings/tests/get_printable_param_impl.hpp @@ -22,11 +22,11 @@ namespace tests { template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>::type* /* junk */, - const typename boost::disable_if>>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if>::value>::type* /* junk */) { std::ostringstream oss; oss << boost::any_cast(data.value); @@ -37,7 +37,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { const T& t = boost::any_cast(data.value); @@ -51,7 +51,7 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& /* data */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */) { return "matrix type"; } @@ -60,8 +60,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& data, - const typename boost::disable_if>::type* /* junk */, - const typename boost::enable_if>::type* /* junk */) + const typename std::enable_if::value>::type* /* junk */, + const typename std::enable_if::value>::type* /* junk */) { // Extract the string from the tuple that's being held. std::ostringstream oss; @@ -73,8 +73,8 @@ std::string GetPrintableParam( template std::string GetPrintableParam( util::ParamData& /* data */, - const typename boost::enable_if>>::type* /* junk */) + const typename std::enable_if>::value>::type* /* junk */) { return "matrix/DatatsetInfo tuple"; } From 2e0b7980e5acc94f3fb8da3715e5c9b573dedf5a Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sun, 27 Jun 2021 17:31:25 +0200 Subject: [PATCH 87/98] Forgetten one.. Signed-off-by: Omar Shrit --- src/mlpack/bindings/cli/in_place_copy.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mlpack/bindings/cli/in_place_copy.hpp b/src/mlpack/bindings/cli/in_place_copy.hpp index d3ed1c9521..f266267bb6 100644 --- a/src/mlpack/bindings/cli/in_place_copy.hpp +++ b/src/mlpack/bindings/cli/in_place_copy.hpp @@ -31,10 +31,10 @@ template void InPlaceCopyInternal( util::ParamData& /* d */, util::ParamData& /* input */, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>::type* = 0, - const typename boost::disable_if>>::type* = 0) + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, + const typename std::enable_if>::value>::type* = 0) { // Nothing to do. } From 96703ce69d67093220d78ba0756b71fca99b9fc8 Mon Sep 17 00:00:00 2001 From: Aakash Kaushik Date: Mon, 28 Jun 2021 21:54:38 +0530 Subject: [PATCH 88/98] correcting serialization param --- src/mlpack/methods/ann/layer/batch_norm_impl.hpp | 2 +- src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mlpack/methods/ann/layer/batch_norm_impl.hpp b/src/mlpack/methods/ann/layer/batch_norm_impl.hpp index 8534f9d5ef..1b6637928c 100644 --- a/src/mlpack/methods/ann/layer/batch_norm_impl.hpp +++ b/src/mlpack/methods/ann/layer/batch_norm_impl.hpp @@ -234,7 +234,7 @@ void BatchNorm::serialize( if (cereal::is_loading()) { weights.set_size(size + size, 1); - loading = false; + loading = true; } ar(CEREAL_NVP(eps)); 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 7bd20415a2..112c625b9b 100644 --- a/src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp +++ b/src/mlpack/methods/ann/layer/virtual_batch_norm_impl.hpp @@ -142,7 +142,7 @@ void VirtualBatchNorm::serialize( if (cereal::is_loading()) { weights.set_size(size + size, 1); - loading = false; + loading = true; } ar(CEREAL_NVP(eps)); From e6ead307efd91c8784af7b187f4e696fb7926d7e Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Tue, 29 Jun 2021 12:03:01 +0200 Subject: [PATCH 89/98] Let us test the asterix solution * Signed-off-by: Omar Shrit --- CMake/Autodownload.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/Autodownload.cmake b/CMake/Autodownload.cmake index 9d93704801..8302e4733c 100644 --- a/CMake/Autodownload.cmake +++ b/CMake/Autodownload.cmake @@ -50,7 +50,7 @@ macro(get_deps LINK DEPS_NAME PACKAGE) install(DIRECTORY "${Boost_INCLUDE_DIR}/boost" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") else() set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include") - install(DIRECTORY "${GENERIC_INCLUDE_DIR}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + install(DIRECTORY "${GENERIC_INCLUDE_DIR}/*" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") endif() else () message(FATAL_ERROR From 4fea37fc2ae43563dd1611df0f2d3df5a7582c99 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Tue, 29 Jun 2021 12:27:25 +0200 Subject: [PATCH 90/98] No need for Asterix Signed-off-by: Omar Shrit --- CMake/Autodownload.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/Autodownload.cmake b/CMake/Autodownload.cmake index 8302e4733c..4864e5004c 100644 --- a/CMake/Autodownload.cmake +++ b/CMake/Autodownload.cmake @@ -50,7 +50,7 @@ macro(get_deps LINK DEPS_NAME PACKAGE) install(DIRECTORY "${Boost_INCLUDE_DIR}/boost" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") else() set(GENERIC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/deps/${DEPENDENCY_DIR}/include") - install(DIRECTORY "${GENERIC_INCLUDE_DIR}/*" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + install(DIRECTORY "${GENERIC_INCLUDE_DIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") endif() else () message(FATAL_ERROR From 68bb344cc13be667f4813efe0a1ecafb2d6ad298 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Thu, 1 Jul 2021 23:32:42 +0200 Subject: [PATCH 91/98] Fix some of them manually, but great solution Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/get_printable_type.hpp | 12 ++++++++---- src/mlpack/bindings/R/get_printable_type_impl.hpp | 14 +++++++++----- src/mlpack/bindings/R/get_r_type.hpp | 12 ++++++++---- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/mlpack/bindings/R/get_printable_type.hpp b/src/mlpack/bindings/R/get_printable_type.hpp index 4b19c21cdf..6ca4932fe1 100644 --- a/src/mlpack/bindings/R/get_printable_type.hpp +++ b/src/mlpack/bindings/R/get_printable_type.hpp @@ -50,10 +50,14 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, + const typename std::enable_if< + !std::is_same>::value>::type*); template<> diff --git a/src/mlpack/bindings/R/get_printable_type_impl.hpp b/src/mlpack/bindings/R/get_printable_type_impl.hpp index a163a615f5..88aa270199 100644 --- a/src/mlpack/bindings/R/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/R/get_printable_type_impl.hpp @@ -58,11 +58,15 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, - const typename std::enable_if>::value>::type*) + const typename std::enable_if< + !util::IsStdVector::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, + const typename std::enable_if< + !std::is_same>::value>::type*) { return "character"; } diff --git a/src/mlpack/bindings/R/get_r_type.hpp b/src/mlpack/bindings/R/get_r_type.hpp index d01559ea66..3e92bb717d 100644 --- a/src/mlpack/bindings/R/get_r_type.hpp +++ b/src/mlpack/bindings/R/get_r_type.hpp @@ -83,10 +83,14 @@ inline std::string GetRType( template<> inline std::string GetRType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, + const typename std::enable_if< + !std::is_same>::value>::type*) { return "character"; From 3f0a40fa107780dda5b4a68ce8f5e9f320677cda Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Thu, 1 Jul 2021 23:47:50 +0200 Subject: [PATCH 92/98] Do the first line with regexp Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/get_type.hpp | 3 ++- src/mlpack/bindings/go/get_go_type.hpp | 3 ++- src/mlpack/bindings/go/get_printable_type.hpp | 3 ++- src/mlpack/bindings/go/get_printable_type_impl.hpp | 3 ++- src/mlpack/bindings/go/get_type.hpp | 3 ++- src/mlpack/bindings/python/get_cython_type.hpp | 3 ++- src/mlpack/bindings/python/get_printable_type.hpp | 3 ++- src/mlpack/bindings/python/get_printable_type_impl.hpp | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/mlpack/bindings/R/get_type.hpp b/src/mlpack/bindings/R/get_type.hpp index 574ec6674c..81d57b99c5 100644 --- a/src/mlpack/bindings/R/get_type.hpp +++ b/src/mlpack/bindings/R/get_type.hpp @@ -72,7 +72,8 @@ inline std::string GetType( template<> inline std::string GetType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if( template<> inline std::string GetGoType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if( template<> inline std::string GetType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*) { diff --git a/src/mlpack/bindings/python/get_cython_type.hpp b/src/mlpack/bindings/python/get_cython_type.hpp index 705b785758..ab3d09e633 100644 --- a/src/mlpack/bindings/python/get_cython_type.hpp +++ b/src/mlpack/bindings/python/get_cython_type.hpp @@ -53,7 +53,8 @@ inline std::string GetCythonType( template<> inline std::string GetCythonType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*) { diff --git a/src/mlpack/bindings/python/get_printable_type.hpp b/src/mlpack/bindings/python/get_printable_type.hpp index 41593e4681..f904fd09c6 100644 --- a/src/mlpack/bindings/python/get_printable_type.hpp +++ b/src/mlpack/bindings/python/get_printable_type.hpp @@ -50,7 +50,8 @@ inline std::string GetPrintableType( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if( template<> inline std::string GetPrintableType( util::ParamData& /* d */, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !util::isStdVector::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if Date: Fri, 2 Jul 2021 09:32:02 +0530 Subject: [PATCH 93/98] Move Sequential layers to LayerTypes (#3004) * Move layers to LayerTypes * remove extra line --- src/mlpack/methods/ann/layer/layer_types.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mlpack/methods/ann/layer/layer_types.hpp b/src/mlpack/methods/ann/layer/layer_types.hpp index d72cd1fa33..e3c97f0d08 100644 --- a/src/mlpack/methods/ann/layer/layer_types.hpp +++ b/src/mlpack/methods/ann/layer/layer_types.hpp @@ -222,6 +222,7 @@ template *, Linear3D*, LpPooling*, PixelShuffle*, @@ -234,8 +235,7 @@ using MoreTypes = boost::variant< ReinforceNormal*, Reparametrization*, Select*, - Sequential*, - Sequential*, + SpatialDropout*, Subview*, VRClassReward*, VirtualBatchNorm*, @@ -277,7 +277,6 @@ using LayerTypes = boost::variant< Dropout*, ELU*, FastLSTM*, - FlexibleReLU*, GRU*, HardTanH*, Join*, @@ -297,8 +296,9 @@ using LayerTypes = boost::variant< NoisyLinear*, Padding*, PReLU*, + Sequential*, + Sequential*, Softmax*, - SpatialDropout*, TransposedConvolution, NaiveConvolution, NaiveConvolution, arma::mat, arma::mat>*, From 5cbf8f81d7c7a6d1307e957e51398b7745c404e8 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Fri, 2 Jul 2021 16:58:01 +0200 Subject: [PATCH 94/98] Fix std::is_same style issue Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/default_param.hpp | 3 ++- src/mlpack/bindings/R/default_param_impl.hpp | 3 ++- src/mlpack/bindings/cli/default_param.hpp | 3 ++- src/mlpack/bindings/cli/default_param_impl.hpp | 3 ++- src/mlpack/bindings/go/default_param.hpp | 3 ++- src/mlpack/bindings/go/default_param_impl.hpp | 3 ++- src/mlpack/bindings/julia/default_param.hpp | 3 ++- src/mlpack/bindings/julia/default_param_impl.hpp | 3 ++- src/mlpack/bindings/python/default_param.hpp | 3 ++- src/mlpack/bindings/python/default_param_impl.hpp | 3 ++- 10 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/mlpack/bindings/R/default_param.hpp b/src/mlpack/bindings/R/default_param.hpp index 8fdf41dfbf..651d976b9b 100644 --- a/src/mlpack/bindings/R/default_param.hpp +++ b/src/mlpack/bindings/R/default_param.hpp @@ -29,7 +29,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, - const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/R/default_param_impl.hpp b/src/mlpack/bindings/R/default_param_impl.hpp index 751834baca..8cf4110696 100644 --- a/src/mlpack/bindings/R/default_param_impl.hpp +++ b/src/mlpack/bindings/R/default_param_impl.hpp @@ -27,7 +27,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, - const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/cli/default_param.hpp b/src/mlpack/bindings/cli/default_param.hpp index 093a03c567..9b5edc9229 100644 --- a/src/mlpack/bindings/cli/default_param.hpp +++ b/src/mlpack/bindings/cli/default_param.hpp @@ -29,7 +29,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, - const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/cli/default_param_impl.hpp b/src/mlpack/bindings/cli/default_param_impl.hpp index b002e94611..33a9524e3f 100644 --- a/src/mlpack/bindings/cli/default_param_impl.hpp +++ b/src/mlpack/bindings/cli/default_param_impl.hpp @@ -27,7 +27,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, - const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/go/default_param.hpp b/src/mlpack/bindings/go/default_param.hpp index 4b967b270e..e2efe85d0a 100644 --- a/src/mlpack/bindings/go/default_param.hpp +++ b/src/mlpack/bindings/go/default_param.hpp @@ -29,7 +29,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, - const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/go/default_param_impl.hpp b/src/mlpack/bindings/go/default_param_impl.hpp index 4d3c0feca1..f33c6cccb3 100644 --- a/src/mlpack/bindings/go/default_param_impl.hpp +++ b/src/mlpack/bindings/go/default_param_impl.hpp @@ -27,7 +27,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, - const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/julia/default_param.hpp b/src/mlpack/bindings/julia/default_param.hpp index fca7d4a488..db714ccc5d 100644 --- a/src/mlpack/bindings/julia/default_param.hpp +++ b/src/mlpack/bindings/julia/default_param.hpp @@ -29,7 +29,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, - const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/julia/default_param_impl.hpp b/src/mlpack/bindings/julia/default_param_impl.hpp index f1a71e7cf2..216758df4f 100644 --- a/src/mlpack/bindings/julia/default_param_impl.hpp +++ b/src/mlpack/bindings/julia/default_param_impl.hpp @@ -27,7 +27,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, - const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/python/default_param.hpp b/src/mlpack/bindings/python/default_param.hpp index 36a6b19c32..cde42983bb 100644 --- a/src/mlpack/bindings/python/default_param.hpp +++ b/src/mlpack/bindings/python/default_param.hpp @@ -29,7 +29,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, - const typename std::enable_if::value>::type* = 0, + const typename std::enable_if::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/python/default_param_impl.hpp b/src/mlpack/bindings/python/default_param_impl.hpp index d953c2efb2..0fe60d8ee0 100644 --- a/src/mlpack/bindings/python/default_param_impl.hpp +++ b/src/mlpack/bindings/python/default_param_impl.hpp @@ -27,7 +27,8 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, - const typename std::enable_if::value>::type*, + const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { From 1beac191adbe216a151ef983c9a7d35a71bc15e7 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Fri, 2 Jul 2021 17:11:37 +0200 Subject: [PATCH 95/98] Break line on HasSerialize Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/get_type.hpp | 3 ++- src/mlpack/bindings/go/get_go_type.hpp | 3 ++- src/mlpack/bindings/go/get_printable_type.hpp | 3 ++- src/mlpack/bindings/go/get_printable_type_impl.hpp | 3 ++- src/mlpack/bindings/go/get_type.hpp | 3 ++- src/mlpack/bindings/python/get_cython_type.hpp | 3 ++- src/mlpack/bindings/python/get_printable_type.hpp | 3 ++- src/mlpack/bindings/python/get_printable_type_impl.hpp | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/mlpack/bindings/R/get_type.hpp b/src/mlpack/bindings/R/get_type.hpp index 81d57b99c5..a39ffc46cb 100644 --- a/src/mlpack/bindings/R/get_type.hpp +++ b/src/mlpack/bindings/R/get_type.hpp @@ -74,7 +74,8 @@ inline std::string GetType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type*) diff --git a/src/mlpack/bindings/go/get_go_type.hpp b/src/mlpack/bindings/go/get_go_type.hpp index 9dbaf67bb7..9fac01f417 100644 --- a/src/mlpack/bindings/go/get_go_type.hpp +++ b/src/mlpack/bindings/go/get_go_type.hpp @@ -75,7 +75,8 @@ inline std::string GetGoType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type*) diff --git a/src/mlpack/bindings/go/get_printable_type.hpp b/src/mlpack/bindings/go/get_printable_type.hpp index 4d4bb18ff7..4ec81417ce 100644 --- a/src/mlpack/bindings/go/get_printable_type.hpp +++ b/src/mlpack/bindings/go/get_printable_type.hpp @@ -52,7 +52,8 @@ inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type*); diff --git a/src/mlpack/bindings/go/get_printable_type_impl.hpp b/src/mlpack/bindings/go/get_printable_type_impl.hpp index 229c14cf8b..33e85f7c06 100644 --- a/src/mlpack/bindings/go/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/go/get_printable_type_impl.hpp @@ -61,7 +61,8 @@ inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type*) diff --git a/src/mlpack/bindings/go/get_type.hpp b/src/mlpack/bindings/go/get_type.hpp index 1d86f84879..5d7f736301 100644 --- a/src/mlpack/bindings/go/get_type.hpp +++ b/src/mlpack/bindings/go/get_type.hpp @@ -66,7 +66,8 @@ inline std::string GetType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*) { return "String"; diff --git a/src/mlpack/bindings/python/get_cython_type.hpp b/src/mlpack/bindings/python/get_cython_type.hpp index ab3d09e633..c9a21f1ed0 100644 --- a/src/mlpack/bindings/python/get_cython_type.hpp +++ b/src/mlpack/bindings/python/get_cython_type.hpp @@ -55,7 +55,8 @@ inline std::string GetCythonType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*) { return "string"; diff --git a/src/mlpack/bindings/python/get_printable_type.hpp b/src/mlpack/bindings/python/get_printable_type.hpp index f904fd09c6..eccd123b1a 100644 --- a/src/mlpack/bindings/python/get_printable_type.hpp +++ b/src/mlpack/bindings/python/get_printable_type.hpp @@ -52,7 +52,8 @@ inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type*); diff --git a/src/mlpack/bindings/python/get_printable_type_impl.hpp b/src/mlpack/bindings/python/get_printable_type_impl.hpp index 4f364e2d3c..836aa9fa1d 100644 --- a/src/mlpack/bindings/python/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/python/get_printable_type_impl.hpp @@ -60,7 +60,8 @@ inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< !util::isStdVector::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !data::HasSerialize::value>::type*, const typename std::enable_if::value>::type*, const typename std::enable_if>::value>::type*) From 0c7b38f17ebdeb007117db330bdbb094161bdcaf Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Fri, 2 Jul 2021 17:17:05 +0200 Subject: [PATCH 96/98] Fix is_arma_type Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/get_type.hpp | 3 ++- src/mlpack/bindings/go/get_go_type.hpp | 3 ++- src/mlpack/bindings/go/get_printable_type.hpp | 3 ++- src/mlpack/bindings/go/get_printable_type_impl.hpp | 3 ++- src/mlpack/bindings/go/get_type.hpp | 3 ++- src/mlpack/bindings/python/get_cython_type.hpp | 3 ++- src/mlpack/bindings/python/get_printable_type.hpp | 3 ++- src/mlpack/bindings/python/get_printable_type_impl.hpp | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/mlpack/bindings/R/get_type.hpp b/src/mlpack/bindings/R/get_type.hpp index a39ffc46cb..b9c6e93c80 100644 --- a/src/mlpack/bindings/R/get_type.hpp +++ b/src/mlpack/bindings/R/get_type.hpp @@ -76,7 +76,8 @@ inline std::string GetType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, const typename std::enable_if>::value>::type*) { diff --git a/src/mlpack/bindings/go/get_go_type.hpp b/src/mlpack/bindings/go/get_go_type.hpp index 9fac01f417..6d00610c47 100644 --- a/src/mlpack/bindings/go/get_go_type.hpp +++ b/src/mlpack/bindings/go/get_go_type.hpp @@ -77,7 +77,8 @@ inline std::string GetGoType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, const typename std::enable_if>::value>::type*) { diff --git a/src/mlpack/bindings/go/get_printable_type.hpp b/src/mlpack/bindings/go/get_printable_type.hpp index 4ec81417ce..0a9593b8cd 100644 --- a/src/mlpack/bindings/go/get_printable_type.hpp +++ b/src/mlpack/bindings/go/get_printable_type.hpp @@ -54,7 +54,8 @@ inline std::string GetPrintableType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, const typename std::enable_if>::value>::type*); diff --git a/src/mlpack/bindings/go/get_printable_type_impl.hpp b/src/mlpack/bindings/go/get_printable_type_impl.hpp index 33e85f7c06..3ef255dd8a 100644 --- a/src/mlpack/bindings/go/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/go/get_printable_type_impl.hpp @@ -63,7 +63,8 @@ inline std::string GetPrintableType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, const typename std::enable_if>::value>::type*) { diff --git a/src/mlpack/bindings/go/get_type.hpp b/src/mlpack/bindings/go/get_type.hpp index 5d7f736301..d6b6d6af88 100644 --- a/src/mlpack/bindings/go/get_type.hpp +++ b/src/mlpack/bindings/go/get_type.hpp @@ -68,7 +68,8 @@ inline std::string GetType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*) + const typename std::enable_if< + !arma::is_arma_type::value>::type*) { return "String"; } diff --git a/src/mlpack/bindings/python/get_cython_type.hpp b/src/mlpack/bindings/python/get_cython_type.hpp index c9a21f1ed0..087b97341e 100644 --- a/src/mlpack/bindings/python/get_cython_type.hpp +++ b/src/mlpack/bindings/python/get_cython_type.hpp @@ -57,7 +57,8 @@ inline std::string GetCythonType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*) + const typename std::enable_if< + !arma::is_arma_type::value>::type*) { return "string"; } diff --git a/src/mlpack/bindings/python/get_printable_type.hpp b/src/mlpack/bindings/python/get_printable_type.hpp index eccd123b1a..12e8783235 100644 --- a/src/mlpack/bindings/python/get_printable_type.hpp +++ b/src/mlpack/bindings/python/get_printable_type.hpp @@ -54,7 +54,8 @@ inline std::string GetPrintableType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, const typename std::enable_if>::value>::type*); diff --git a/src/mlpack/bindings/python/get_printable_type_impl.hpp b/src/mlpack/bindings/python/get_printable_type_impl.hpp index 836aa9fa1d..d6517c8139 100644 --- a/src/mlpack/bindings/python/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/python/get_printable_type_impl.hpp @@ -62,7 +62,8 @@ inline std::string GetPrintableType( !util::isStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, - const typename std::enable_if::value>::type*, + const typename std::enable_if< + !arma::is_arma_type::value>::type*, const typename std::enable_if>::value>::type*) { From a27700b0724b7ff5dc991e878533ee345b4f827a Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Fri, 2 Jul 2021 17:31:05 +0200 Subject: [PATCH 97/98] Fix regexp error Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/default_param.hpp | 2 +- src/mlpack/bindings/R/default_param_impl.hpp | 2 +- src/mlpack/bindings/cli/default_param.hpp | 2 +- src/mlpack/bindings/cli/default_param_impl.hpp | 2 +- src/mlpack/bindings/go/default_param.hpp | 2 +- src/mlpack/bindings/go/default_param_impl.hpp | 2 +- src/mlpack/bindings/julia/default_param.hpp | 2 +- src/mlpack/bindings/julia/default_param_impl.hpp | 2 +- src/mlpack/bindings/python/default_param.hpp | 2 +- src/mlpack/bindings/python/default_param_impl.hpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mlpack/bindings/R/default_param.hpp b/src/mlpack/bindings/R/default_param.hpp index 651d976b9b..2006e2eb23 100644 --- a/src/mlpack/bindings/R/default_param.hpp +++ b/src/mlpack/bindings/R/default_param.hpp @@ -30,7 +30,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, + std::string>::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/R/default_param_impl.hpp b/src/mlpack/bindings/R/default_param_impl.hpp index 8cf4110696..5447d8738a 100644 --- a/src/mlpack/bindings/R/default_param_impl.hpp +++ b/src/mlpack/bindings/R/default_param_impl.hpp @@ -28,7 +28,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type*, + std::string>::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/cli/default_param.hpp b/src/mlpack/bindings/cli/default_param.hpp index 9b5edc9229..9be4b4c73d 100644 --- a/src/mlpack/bindings/cli/default_param.hpp +++ b/src/mlpack/bindings/cli/default_param.hpp @@ -30,7 +30,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, + std::string>::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/cli/default_param_impl.hpp b/src/mlpack/bindings/cli/default_param_impl.hpp index 33a9524e3f..b9defc6374 100644 --- a/src/mlpack/bindings/cli/default_param_impl.hpp +++ b/src/mlpack/bindings/cli/default_param_impl.hpp @@ -28,7 +28,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type*, + std::string>::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/go/default_param.hpp b/src/mlpack/bindings/go/default_param.hpp index e2efe85d0a..3ebdaae7b3 100644 --- a/src/mlpack/bindings/go/default_param.hpp +++ b/src/mlpack/bindings/go/default_param.hpp @@ -30,7 +30,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, + std::string>::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/go/default_param_impl.hpp b/src/mlpack/bindings/go/default_param_impl.hpp index f33c6cccb3..2458012966 100644 --- a/src/mlpack/bindings/go/default_param_impl.hpp +++ b/src/mlpack/bindings/go/default_param_impl.hpp @@ -28,7 +28,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type*, + std::string>::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/julia/default_param.hpp b/src/mlpack/bindings/julia/default_param.hpp index db714ccc5d..0d2b368381 100644 --- a/src/mlpack/bindings/julia/default_param.hpp +++ b/src/mlpack/bindings/julia/default_param.hpp @@ -30,7 +30,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, + std::string>::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/julia/default_param_impl.hpp b/src/mlpack/bindings/julia/default_param_impl.hpp index 216758df4f..667ecae5f4 100644 --- a/src/mlpack/bindings/julia/default_param_impl.hpp +++ b/src/mlpack/bindings/julia/default_param_impl.hpp @@ -28,7 +28,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type*, + std::string>::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { diff --git a/src/mlpack/bindings/python/default_param.hpp b/src/mlpack/bindings/python/default_param.hpp index cde42983bb..5f8bc32ea4 100644 --- a/src/mlpack/bindings/python/default_param.hpp +++ b/src/mlpack/bindings/python/default_param.hpp @@ -30,7 +30,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, const typename std::enable_if::value>::type* = 0, + std::string>::value>::type* = 0, const typename std::enable_if>::value>::type* = 0); diff --git a/src/mlpack/bindings/python/default_param_impl.hpp b/src/mlpack/bindings/python/default_param_impl.hpp index 0fe60d8ee0..543253c18b 100644 --- a/src/mlpack/bindings/python/default_param_impl.hpp +++ b/src/mlpack/bindings/python/default_param_impl.hpp @@ -28,7 +28,7 @@ std::string DefaultParamImpl( const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type* /* junk */, const typename std::enable_if::value>::type*, + std::string>::value>::type*, const typename std::enable_if>::value>::type* /* junk */) { From bbb8b4b640aaa7ed37f3afd1e7e3981edf111d32 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Fri, 2 Jul 2021 17:42:34 +0200 Subject: [PATCH 98/98] Fix IsStdVector Signed-off-by: Omar Shrit --- src/mlpack/bindings/R/get_type.hpp | 2 +- src/mlpack/bindings/go/get_go_type.hpp | 2 +- src/mlpack/bindings/go/get_printable_type.hpp | 2 +- src/mlpack/bindings/go/get_printable_type_impl.hpp | 2 +- src/mlpack/bindings/go/get_type.hpp | 2 +- src/mlpack/bindings/python/get_cython_type.hpp | 2 +- src/mlpack/bindings/python/get_printable_type.hpp | 2 +- src/mlpack/bindings/python/get_printable_type_impl.hpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mlpack/bindings/R/get_type.hpp b/src/mlpack/bindings/R/get_type.hpp index b9c6e93c80..55264eedb5 100644 --- a/src/mlpack/bindings/R/get_type.hpp +++ b/src/mlpack/bindings/R/get_type.hpp @@ -73,7 +73,7 @@ template<> inline std::string GetType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if< diff --git a/src/mlpack/bindings/go/get_go_type.hpp b/src/mlpack/bindings/go/get_go_type.hpp index 6d00610c47..4fc800ecbf 100644 --- a/src/mlpack/bindings/go/get_go_type.hpp +++ b/src/mlpack/bindings/go/get_go_type.hpp @@ -74,7 +74,7 @@ template<> inline std::string GetGoType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if< diff --git a/src/mlpack/bindings/go/get_printable_type.hpp b/src/mlpack/bindings/go/get_printable_type.hpp index 0a9593b8cd..5b2cadece3 100644 --- a/src/mlpack/bindings/go/get_printable_type.hpp +++ b/src/mlpack/bindings/go/get_printable_type.hpp @@ -51,7 +51,7 @@ template<> inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if< diff --git a/src/mlpack/bindings/go/get_printable_type_impl.hpp b/src/mlpack/bindings/go/get_printable_type_impl.hpp index 3ef255dd8a..cdbfe9feb5 100644 --- a/src/mlpack/bindings/go/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/go/get_printable_type_impl.hpp @@ -60,7 +60,7 @@ template<> inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if< diff --git a/src/mlpack/bindings/go/get_type.hpp b/src/mlpack/bindings/go/get_type.hpp index d6b6d6af88..828085d375 100644 --- a/src/mlpack/bindings/go/get_type.hpp +++ b/src/mlpack/bindings/go/get_type.hpp @@ -65,7 +65,7 @@ template<> inline std::string GetType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if< diff --git a/src/mlpack/bindings/python/get_cython_type.hpp b/src/mlpack/bindings/python/get_cython_type.hpp index 087b97341e..9809e1224e 100644 --- a/src/mlpack/bindings/python/get_cython_type.hpp +++ b/src/mlpack/bindings/python/get_cython_type.hpp @@ -54,7 +54,7 @@ template<> inline std::string GetCythonType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if< diff --git a/src/mlpack/bindings/python/get_printable_type.hpp b/src/mlpack/bindings/python/get_printable_type.hpp index 12e8783235..1d454b172a 100644 --- a/src/mlpack/bindings/python/get_printable_type.hpp +++ b/src/mlpack/bindings/python/get_printable_type.hpp @@ -51,7 +51,7 @@ template<> inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if< diff --git a/src/mlpack/bindings/python/get_printable_type_impl.hpp b/src/mlpack/bindings/python/get_printable_type_impl.hpp index d6517c8139..5a903af575 100644 --- a/src/mlpack/bindings/python/get_printable_type_impl.hpp +++ b/src/mlpack/bindings/python/get_printable_type_impl.hpp @@ -59,7 +59,7 @@ template<> inline std::string GetPrintableType( util::ParamData& /* d */, const typename std::enable_if< - !util::isStdVector::value>::type*, + !util::IsStdVector::value>::type*, const typename std::enable_if< !data::HasSerialize::value>::type*, const typename std::enable_if<