diff --git a/RTNeural/CMakeLists.txt b/RTNeural/CMakeLists.txt index 61f1876a..c7107bac 100755 --- a/RTNeural/CMakeLists.txt +++ b/RTNeural/CMakeLists.txt @@ -46,3 +46,8 @@ target_include_directories(RTNeural INTERFACE .. ) +set(RTNEURAL_NAMESPACE "RTNeural" CACHE STRING "Namespace to use for RTNeural code") +target_compile_definitions(RTNeural + PUBLIC + RTNEURAL_NAMESPACE=${RTNEURAL_NAMESPACE} +) \ No newline at end of file diff --git a/RTNeural/Layer.h b/RTNeural/Layer.h index 5ea2ef65..d5dcb74c 100644 --- a/RTNeural/Layer.h +++ b/RTNeural/Layer.h @@ -4,7 +4,7 @@ #include #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Virtual base class for a generic neural network layer. */ @@ -34,6 +34,6 @@ class Layer const int out_size; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // LAYER_H_INCLUDED diff --git a/RTNeural/Model.h b/RTNeural/Model.h index 9144b513..d23f1c0c 100644 --- a/RTNeural/Model.h +++ b/RTNeural/Model.h @@ -19,7 +19,7 @@ #include "lstm/lstm.h" #include "lstm/lstm.tpp" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -112,6 +112,6 @@ class Model std::vector outs; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // MODEL_H_INCLUDED diff --git a/RTNeural/ModelT.h b/RTNeural/ModelT.h index 7376e6bf..a90882bb 100644 --- a/RTNeural/ModelT.h +++ b/RTNeural/ModelT.h @@ -2,7 +2,7 @@ #include "model_loader.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { #ifndef DOXYGEN @@ -575,4 +575,4 @@ class ModelT2D static constexpr size_t n_layers = sizeof...(Layers); }; #endif // RTNEURAL_USE_XSIMD -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/RTNeural.cpp b/RTNeural/RTNeural.cpp index 92e6daeb..1ce85cdb 100644 --- a/RTNeural/RTNeural.cpp +++ b/RTNeural/RTNeural.cpp @@ -1,7 +1,7 @@ #include "RTNeural.h" // forward declare some template classes -template class RTNeural::Model; -template class RTNeural::Model; -template class RTNeural::Layer; -template class RTNeural::Layer; +template class RTNEURAL_NAMESPACE::Model; +template class RTNEURAL_NAMESPACE::Model; +template class RTNEURAL_NAMESPACE::Layer; +template class RTNEURAL_NAMESPACE::Layer; diff --git a/RTNeural/RTNeural.h b/RTNeural/RTNeural.h index 482e17f2..af7e450f 100644 --- a/RTNeural/RTNeural.h +++ b/RTNeural/RTNeural.h @@ -5,6 +5,10 @@ // C++ STL includes #include +#ifndef RTNEURAL_NAMESPACE +#define RTNEURAL_NAMESPACE RTNeural +#endif + // Handle default RTNeural defines #ifndef RTNEURAL_DEFAULT_ALIGNMENT #if _MSC_VER diff --git a/RTNeural/activation/activation.h b/RTNeural/activation/activation.h index c591dd54..3cc19c24 100644 --- a/RTNeural/activation/activation.h +++ b/RTNeural/activation/activation.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Base class for activation layers. */ @@ -35,7 +35,7 @@ class Activation : public Layer const std::function func; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #if RTNEURAL_USE_EIGEN #include "activation_eigen.h" @@ -48,7 +48,7 @@ class Activation : public Layer #include "../maths/maths_stl.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic implementation of a tanh activation layer. */ @@ -424,7 +424,7 @@ class PReLUActivationT T outs[size]; T alpha[size]; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // RTNEURAL_USE_EIGEN diff --git a/RTNeural/activation/activation_eigen.h b/RTNeural/activation/activation_eigen.h index 49ee79b0..18699b6e 100644 --- a/RTNeural/activation/activation_eigen.h +++ b/RTNeural/activation/activation_eigen.h @@ -4,7 +4,7 @@ #include "../common.h" #include "../maths/maths_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic implementation of a tanh activation layer. */ @@ -463,6 +463,6 @@ class PReLUActivationT T outs_internal alignas(RTNEURAL_DEFAULT_ALIGNMENT)[out_size]; v_type alpha; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // ACTIVATIONEIGEN_H_INCLUDED diff --git a/RTNeural/activation/activation_xsimd.h b/RTNeural/activation/activation_xsimd.h index d84cff17..2b201e9b 100644 --- a/RTNeural/activation/activation_xsimd.h +++ b/RTNeural/activation/activation_xsimd.h @@ -4,7 +4,7 @@ #include "../common.h" #include "../maths/maths_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic implementation of a tanh activation layer. */ @@ -430,6 +430,6 @@ class PReLUActivationT v_type outs[v_io_size]; v_type alpha[v_io_size]; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // ACTIVATIONXSIMD_H_INCLUDED diff --git a/RTNeural/batchnorm/batchnorm.h b/RTNeural/batchnorm/batchnorm.h index 056983c2..2c66821a 100644 --- a/RTNeural/batchnorm/batchnorm.h +++ b/RTNeural/batchnorm/batchnorm.h @@ -12,7 +12,7 @@ #include "../common.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic batch normalization layer. */ template diff --git a/RTNeural/batchnorm/batchnorm.tpp b/RTNeural/batchnorm/batchnorm.tpp index 746d3acf..73828491 100644 --- a/RTNeural/batchnorm/batchnorm.tpp +++ b/RTNeural/batchnorm/batchnorm.tpp @@ -1,6 +1,6 @@ #include "batchnorm.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { #if !RTNEURAL_USE_EIGEN && !RTNEURAL_USE_XSIMD diff --git a/RTNeural/batchnorm/batchnorm2d.h b/RTNeural/batchnorm/batchnorm2d.h index f15cb0b7..a11dbca0 100644 --- a/RTNeural/batchnorm/batchnorm2d.h +++ b/RTNeural/batchnorm/batchnorm2d.h @@ -10,7 +10,7 @@ #else #include "../Layer.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic batch normalization layer. */ template diff --git a/RTNeural/batchnorm/batchnorm2d.tpp b/RTNeural/batchnorm/batchnorm2d.tpp index 4cae8531..12699e3a 100644 --- a/RTNeural/batchnorm/batchnorm2d.tpp +++ b/RTNeural/batchnorm/batchnorm2d.tpp @@ -2,7 +2,7 @@ #if !RTNEURAL_USE_EIGEN && !RTNEURAL_USE_XSIMD -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template BatchNorm2DLayer::BatchNorm2DLayer(int in_num_filters, int in_num_features) diff --git a/RTNeural/batchnorm/batchnorm2d_eigen.h b/RTNeural/batchnorm/batchnorm2d_eigen.h index 747b0652..e3ee59db 100644 --- a/RTNeural/batchnorm/batchnorm2d_eigen.h +++ b/RTNeural/batchnorm/batchnorm2d_eigen.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic batch normalization layer. */ template diff --git a/RTNeural/batchnorm/batchnorm2d_eigen.tpp b/RTNeural/batchnorm/batchnorm2d_eigen.tpp index d52e233f..2e41a4ad 100644 --- a/RTNeural/batchnorm/batchnorm2d_eigen.tpp +++ b/RTNeural/batchnorm/batchnorm2d_eigen.tpp @@ -1,6 +1,6 @@ #include "batchnorm2d_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template BatchNorm2DLayer::BatchNorm2DLayer(int in_num_filters, int in_num_features) diff --git a/RTNeural/batchnorm/batchnorm2d_xsimd.h b/RTNeural/batchnorm/batchnorm2d_xsimd.h index 1da4a560..edb35d56 100644 --- a/RTNeural/batchnorm/batchnorm2d_xsimd.h +++ b/RTNeural/batchnorm/batchnorm2d_xsimd.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic batch normalization layer. */ template diff --git a/RTNeural/batchnorm/batchnorm2d_xsimd.tpp b/RTNeural/batchnorm/batchnorm2d_xsimd.tpp index 6d9b6cc4..ca17b5f0 100644 --- a/RTNeural/batchnorm/batchnorm2d_xsimd.tpp +++ b/RTNeural/batchnorm/batchnorm2d_xsimd.tpp @@ -1,6 +1,6 @@ #include "batchnorm2d_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template BatchNorm2DLayer::BatchNorm2DLayer(int in_num_filters, int in_num_features) diff --git a/RTNeural/batchnorm/batchnorm_eigen.h b/RTNeural/batchnorm/batchnorm_eigen.h index b46fcdc5..e1597d5d 100644 --- a/RTNeural/batchnorm/batchnorm_eigen.h +++ b/RTNeural/batchnorm/batchnorm_eigen.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic batch normalization layer. */ template diff --git a/RTNeural/batchnorm/batchnorm_eigen.tpp b/RTNeural/batchnorm/batchnorm_eigen.tpp index 02983bbd..b2657f6e 100644 --- a/RTNeural/batchnorm/batchnorm_eigen.tpp +++ b/RTNeural/batchnorm/batchnorm_eigen.tpp @@ -1,6 +1,6 @@ #include "batchnorm_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template BatchNorm1DLayer::BatchNorm1DLayer(int size) diff --git a/RTNeural/batchnorm/batchnorm_xsimd.h b/RTNeural/batchnorm/batchnorm_xsimd.h index 87691984..c709bad0 100644 --- a/RTNeural/batchnorm/batchnorm_xsimd.h +++ b/RTNeural/batchnorm/batchnorm_xsimd.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Dynamic batch normalization layer. */ template diff --git a/RTNeural/batchnorm/batchnorm_xsimd.tpp b/RTNeural/batchnorm/batchnorm_xsimd.tpp index 742c3362..3946af32 100644 --- a/RTNeural/batchnorm/batchnorm_xsimd.tpp +++ b/RTNeural/batchnorm/batchnorm_xsimd.tpp @@ -1,6 +1,6 @@ #include "batchnorm_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template BatchNorm1DLayer::BatchNorm1DLayer(int size) diff --git a/RTNeural/common.h b/RTNeural/common.h index efe760f6..ed8320fc 100644 --- a/RTNeural/common.h +++ b/RTNeural/common.h @@ -1,6 +1,6 @@ #pragma once -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -29,26 +29,26 @@ constexpr T ceil_div(T num, T den) { return (num + den - 1) / den; } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #if RTNEURAL_USE_EIGEN #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { #if RTNEURAL_DEFAULT_ALIGNMENT == 32 constexpr auto RTNeuralEigenAlignment = Eigen::Aligned32; #else constexpr auto RTNeuralEigenAlignment = Eigen::Aligned16; #endif -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #elif RTNEURAL_USE_XSIMD #include #include "xsimd-legacy/algorithms/algorithms.hpp" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template @@ -236,20 +236,20 @@ static inline void elu(const T* in, T* out, int dim, T alpha) noexcept for(auto i = vec_size; i < dim; ++i) out[i] = in[i] > (T)0 ? in[i] : (alpha * (MathsProvider::exp(in[i]) - (T)1)); } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #else // STL backend #include #include #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template static inline T vMult(const T* arg1, const T* arg2, int dim) noexcept { return std::inner_product(arg1, arg1 + dim, arg2, (T)0); } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif diff --git a/RTNeural/conv1d/conv1d.h b/RTNeural/conv1d/conv1d.h index ed513aa8..382c4977 100644 --- a/RTNeural/conv1d/conv1d.h +++ b/RTNeural/conv1d/conv1d.h @@ -12,7 +12,7 @@ #include "../common.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -241,6 +241,6 @@ class Conv1DT state_ptrs[k] = (state_ptr + state_size - k * dilation_rate) % state_size; } }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif #endif // CONV1D_H_INCLUDED diff --git a/RTNeural/conv1d/conv1d.tpp b/RTNeural/conv1d/conv1d.tpp index 147b3d92..9ab9a03a 100644 --- a/RTNeural/conv1d/conv1d.tpp +++ b/RTNeural/conv1d/conv1d.tpp @@ -1,6 +1,6 @@ #include "conv1d.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { #if !RTNEURAL_USE_EIGEN && !RTNEURAL_USE_XSIMD @@ -166,4 +166,4 @@ void Conv1DT: #endif -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/conv1d/conv1d_eigen.h b/RTNeural/conv1d/conv1d_eigen.h index e0bcb4bb..bca2209c 100644 --- a/RTNeural/conv1d/conv1d_eigen.h +++ b/RTNeural/conv1d/conv1d_eigen.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -214,6 +214,6 @@ class Conv1DT } }; -} // RTNeural +} // RTNEURAL_NAMESPACE #endif // CONV1DEIGEN_H_INCLUDED diff --git a/RTNeural/conv1d/conv1d_eigen.tpp b/RTNeural/conv1d/conv1d_eigen.tpp index c2a15797..957fb16b 100644 --- a/RTNeural/conv1d/conv1d_eigen.tpp +++ b/RTNeural/conv1d/conv1d_eigen.tpp @@ -1,6 +1,6 @@ #include "conv1d_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template @@ -105,4 +105,4 @@ void Conv1DT: bias(i) = biasVals[i]; } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/conv1d/conv1d_xsimd.h b/RTNeural/conv1d/conv1d_xsimd.h index 3ccbc563..60e11f7a 100644 --- a/RTNeural/conv1d/conv1d_xsimd.h +++ b/RTNeural/conv1d/conv1d_xsimd.h @@ -6,7 +6,7 @@ #include #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -313,6 +313,6 @@ class Conv1DT state_ptrs[k] = (state_ptr + state_size - k * dilation_rate) % state_size; } }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // CONV1DXSIMD_H_INCLUDED diff --git a/RTNeural/conv1d/conv1d_xsimd.tpp b/RTNeural/conv1d/conv1d_xsimd.tpp index 7d3d03fd..ce02502d 100644 --- a/RTNeural/conv1d/conv1d_xsimd.tpp +++ b/RTNeural/conv1d/conv1d_xsimd.tpp @@ -1,6 +1,6 @@ #include "conv1d_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template @@ -126,4 +126,4 @@ void Conv1DT: bias[i / v_size] = set_value(bias[i / v_size], i % v_size, biasVals[i]); } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/conv1d_stateless/conv1d_stateless.h b/RTNeural/conv1d_stateless/conv1d_stateless.h index c115dac5..b15d135b 100644 --- a/RTNeural/conv1d_stateless/conv1d_stateless.h +++ b/RTNeural/conv1d_stateless/conv1d_stateless.h @@ -10,7 +10,7 @@ #else #include "../Layer.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** * Dynamic implementation of a 1-dimensional stateless convolution layer with no activation. diff --git a/RTNeural/conv1d_stateless/conv1d_stateless.tpp b/RTNeural/conv1d_stateless/conv1d_stateless.tpp index b3e2050e..2431143e 100644 --- a/RTNeural/conv1d_stateless/conv1d_stateless.tpp +++ b/RTNeural/conv1d_stateless/conv1d_stateless.tpp @@ -1,6 +1,6 @@ #include "conv1d_stateless.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template Conv1DStateless::Conv1DStateless(int in_num_filters_in, int in_num_features_in, int in_num_filters_out, int in_kernel_size, int in_stride, bool in_valid_pad) @@ -78,4 +78,4 @@ void Conv1DStatelessT -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** * Dynamic implementation of a 1-dimensional stateless convolution layer with no activation. diff --git a/RTNeural/conv1d_stateless/conv1d_stateless_eigen.tpp b/RTNeural/conv1d_stateless/conv1d_stateless_eigen.tpp index f8dca7f8..f86ca00e 100644 --- a/RTNeural/conv1d_stateless/conv1d_stateless_eigen.tpp +++ b/RTNeural/conv1d_stateless/conv1d_stateless_eigen.tpp @@ -1,6 +1,6 @@ #include "conv1d_stateless_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template Conv1DStateless::Conv1DStateless(int in_num_filters_in, int in_num_features_in, int in_num_filters_out, int in_kernel_size, int in_stride, bool in_valid_pad) @@ -72,4 +72,4 @@ void Conv1DStatelessT -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** * Dynamic implementation of a 1-dimensional stateless convolution layer with no activation. diff --git a/RTNeural/conv1d_stateless/conv1d_stateless_xsimd.tpp b/RTNeural/conv1d_stateless/conv1d_stateless_xsimd.tpp index 5f602e01..42cccffe 100644 --- a/RTNeural/conv1d_stateless/conv1d_stateless_xsimd.tpp +++ b/RTNeural/conv1d_stateless/conv1d_stateless_xsimd.tpp @@ -1,6 +1,6 @@ #include "conv1d_stateless_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template Conv1DStateless::Conv1DStateless(int in_num_filters_in, int in_num_features_in, int in_num_filters_out, int in_kernel_size, int in_stride, bool in_valid_pad) @@ -71,4 +71,4 @@ void Conv1DStatelessT Conv2D::Conv2D(int in_num_filters_in, int in_num_filters_out, int in_num_features_in, int in_kernel_size_time, int in_kernel_size_feature, @@ -87,6 +87,6 @@ void Conv2DT -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** * Dynamic implementation of a 2-dimensional convolution layer with no activation. diff --git a/RTNeural/conv2d/conv2d_eigen.tpp b/RTNeural/conv2d/conv2d_eigen.tpp index d913e6f0..7ede4590 100644 --- a/RTNeural/conv2d/conv2d_eigen.tpp +++ b/RTNeural/conv2d/conv2d_eigen.tpp @@ -1,6 +1,6 @@ #include "conv2d_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template Conv2D::Conv2D(int in_num_filters_in, int in_num_filters_out, int in_num_features_in, int in_kernel_size_time, int in_kernel_size_feature, @@ -88,4 +88,4 @@ void Conv2DT -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** * Dynamic implementation of a 2-dimensional convolution layer with no activation. diff --git a/RTNeural/conv2d/conv2d_xsimd.tpp b/RTNeural/conv2d/conv2d_xsimd.tpp index c195b05e..c6fbbceb 100644 --- a/RTNeural/conv2d/conv2d_xsimd.tpp +++ b/RTNeural/conv2d/conv2d_xsimd.tpp @@ -1,6 +1,6 @@ #include "conv2d_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template Conv2D::Conv2D(int in_num_filters_in, int in_num_filters_out, int in_num_features_in, int in_kernel_size_time, int in_kernel_size_feature, @@ -85,4 +85,4 @@ void Conv2DT(std::begin(bias))); } -} // RTNeural +} // RTNEURAL_NAMESPACE diff --git a/RTNeural/dense/dense.h b/RTNeural/dense/dense.h index 19d6b9ce..76395f47 100644 --- a/RTNeural/dense/dense.h +++ b/RTNeural/dense/dense.h @@ -12,7 +12,7 @@ #else #include "../Layer.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { #ifndef DOXYGEN @@ -246,7 +246,7 @@ class DenseT T weights[weights_size]; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // RTNEURAL_USE_STL diff --git a/RTNeural/dense/dense_eigen.h b/RTNeural/dense/dense_eigen.h index 09fb4bbe..d858c0ef 100644 --- a/RTNeural/dense/dense_eigen.h +++ b/RTNeural/dense/dense_eigen.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -204,6 +204,6 @@ class DenseT mat_type weights; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // DENSEEIGEN_H_INCLUDED diff --git a/RTNeural/dense/dense_xsimd.h b/RTNeural/dense/dense_xsimd.h index d1bb9e7d..15d797e5 100644 --- a/RTNeural/dense/dense_xsimd.h +++ b/RTNeural/dense/dense_xsimd.h @@ -4,7 +4,7 @@ #include "../Layer.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -382,6 +382,6 @@ class DenseT v_type weights[v_out_size]; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // DENSEXSIMD_H_INCLUDED diff --git a/RTNeural/gru/gru.h b/RTNeural/gru/gru.h index 406cf4ca..6d452420 100644 --- a/RTNeural/gru/gru.h +++ b/RTNeural/gru/gru.h @@ -15,7 +15,7 @@ #include "../maths/maths_stl.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -339,7 +339,7 @@ class GRULayerT T delayPlus1Mult = (T)0; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // RTNEURAL_USE_EIGEN diff --git a/RTNeural/gru/gru.tpp b/RTNeural/gru/gru.tpp index e4d9b540..1c3c76ff 100644 --- a/RTNeural/gru/gru.tpp +++ b/RTNeural/gru/gru.tpp @@ -1,6 +1,6 @@ #include "gru.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { #if !RTNEURAL_USE_EIGEN && !RTNEURAL_USE_XSIMD @@ -361,4 +361,4 @@ void GRULayerT::setBVals( #endif // !RTNEURAL_USE_EIGEN && !RTNEURAL_USE_XSIMD -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/gru/gru_eigen.h b/RTNeural/gru/gru_eigen.h index f4a02410..54e468fb 100644 --- a/RTNeural/gru/gru_eigen.h +++ b/RTNeural/gru/gru_eigen.h @@ -5,7 +5,7 @@ #include "../common.h" #include "../maths/maths_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -330,6 +330,6 @@ class GRULayerT T delayPlus1Mult = (T)0; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // GRUEIGEN_H_INCLUDED diff --git a/RTNeural/gru/gru_eigen.tpp b/RTNeural/gru/gru_eigen.tpp index c3e3b835..ab07b8eb 100644 --- a/RTNeural/gru/gru_eigen.tpp +++ b/RTNeural/gru/gru_eigen.tpp @@ -2,7 +2,7 @@ #include "gru_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template @@ -235,6 +235,6 @@ void GRULayerT::setBVals( } } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // RTNEURAL_USE_EIGEN diff --git a/RTNeural/gru/gru_xsimd.h b/RTNeural/gru/gru_xsimd.h index 556628ea..665ff107 100644 --- a/RTNeural/gru/gru_xsimd.h +++ b/RTNeural/gru/gru_xsimd.h @@ -5,7 +5,7 @@ #include "../common.h" #include "../maths/maths_xsimd.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -380,6 +380,6 @@ class GRULayerT v_type delayPlus1Mult = (T)0; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // GRUXSIMD_H_INCLUDED diff --git a/RTNeural/gru/gru_xsimd.tpp b/RTNeural/gru/gru_xsimd.tpp index 7833b0ed..2c797f38 100644 --- a/RTNeural/gru/gru_xsimd.tpp +++ b/RTNeural/gru/gru_xsimd.tpp @@ -1,6 +1,6 @@ #include "gru_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template @@ -334,4 +334,4 @@ void GRULayerT::setBVals( } } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/lstm/lstm.h b/RTNeural/lstm/lstm.h index a9d3f374..c4a85d80 100644 --- a/RTNeural/lstm/lstm.h +++ b/RTNeural/lstm/lstm.h @@ -13,7 +13,7 @@ #include "../maths/maths_stl.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -345,7 +345,7 @@ class LSTMLayerT T delayPlus1Mult = (T)0; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif diff --git a/RTNeural/lstm/lstm.tpp b/RTNeural/lstm/lstm.tpp index d41d7004..4e6b29e3 100644 --- a/RTNeural/lstm/lstm.tpp +++ b/RTNeural/lstm/lstm.tpp @@ -1,6 +1,6 @@ #include "lstm.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { #if !RTNEURAL_USE_EIGEN && !RTNEURAL_USE_XSIMD @@ -284,4 +284,4 @@ void LSTMLayerT::setBVals #endif // !RTNEURAL_USE_EIGEN && !RTNEURAL_USE_XSIMD -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/lstm/lstm_eigen.h b/RTNeural/lstm/lstm_eigen.h index 38a7f5bb..3d614d0f 100644 --- a/RTNeural/lstm/lstm_eigen.h +++ b/RTNeural/lstm/lstm_eigen.h @@ -5,7 +5,7 @@ #include "../common.h" #include "../maths/maths_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -275,6 +275,6 @@ class LSTMLayerT T delayPlus1Mult = (T)0; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // LSTM_EIGEN_INCLUDED diff --git a/RTNeural/lstm/lstm_eigen.tpp b/RTNeural/lstm/lstm_eigen.tpp index 105ab151..c48301dd 100644 --- a/RTNeural/lstm/lstm_eigen.tpp +++ b/RTNeural/lstm/lstm_eigen.tpp @@ -1,6 +1,6 @@ #include "lstm_eigen.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template @@ -205,4 +205,4 @@ void LSTMLayerT::setBVals } } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/lstm/lstm_xsimd.h b/RTNeural/lstm/lstm_xsimd.h index 203e3c47..9ef8af0a 100644 --- a/RTNeural/lstm/lstm_xsimd.h +++ b/RTNeural/lstm/lstm_xsimd.h @@ -6,7 +6,7 @@ #include "../maths/maths_xsimd.h" #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** @@ -392,6 +392,6 @@ class LSTMLayerT v_type delayPlus1Mult = (T)0; }; -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE #endif // LSTM_XSIMD_H_INCLUDED diff --git a/RTNeural/lstm/lstm_xsimd.tpp b/RTNeural/lstm/lstm_xsimd.tpp index 1b5ca605..ad1f1b96 100644 --- a/RTNeural/lstm/lstm_xsimd.tpp +++ b/RTNeural/lstm/lstm_xsimd.tpp @@ -1,6 +1,6 @@ #include "lstm_xsimd.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { template @@ -256,4 +256,4 @@ void LSTMLayerT::setBVals } } -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/maths/maths_eigen.h b/RTNeural/maths/maths_eigen.h index a061b620..3f7c8be3 100644 --- a/RTNeural/maths/maths_eigen.h +++ b/RTNeural/maths/maths_eigen.h @@ -2,7 +2,7 @@ #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { struct DefaultMathsProvider { diff --git a/RTNeural/maths/maths_stl.h b/RTNeural/maths/maths_stl.h index 3210e7cc..ae9d76c1 100644 --- a/RTNeural/maths/maths_stl.h +++ b/RTNeural/maths/maths_stl.h @@ -2,7 +2,7 @@ #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { struct DefaultMathsProvider { diff --git a/RTNeural/maths/maths_xsimd.h b/RTNeural/maths/maths_xsimd.h index 80c20dbf..45a6177c 100644 --- a/RTNeural/maths/maths_xsimd.h +++ b/RTNeural/maths/maths_xsimd.h @@ -2,7 +2,7 @@ #include -namespace RTNeural +namespace RTNEURAL_NAMESPACE { struct DefaultMathsProvider { diff --git a/RTNeural/model_loader.h b/RTNeural/model_loader.h index 836cd000..10daf051 100644 --- a/RTNeural/model_loader.h +++ b/RTNeural/model_loader.h @@ -16,7 +16,7 @@ #define RTNEURAL_MAYBE_UNUSED #endif -namespace RTNeural +namespace RTNEURAL_NAMESPACE { /** Utility functions for loading model weights from their json representation. */ namespace json_parser @@ -718,4 +718,4 @@ namespace json_parser } } // namespace json_parser -} // namespace RTNeural +} // namespace RTNEURAL_NAMESPACE diff --git a/RTNeural/torch_helpers.h b/RTNeural/torch_helpers.h index 78533185..25401fc5 100644 --- a/RTNeural/torch_helpers.h +++ b/RTNeural/torch_helpers.h @@ -2,7 +2,7 @@ #include "model_loader.h" -namespace RTNeural +namespace RTNEURAL_NAMESPACE { namespace torch_helpers { diff --git a/examples/hello_rtneural/Makefile b/examples/hello_rtneural/Makefile index 00f10103..a4dc267a 100644 --- a/examples/hello_rtneural/Makefile +++ b/examples/hello_rtneural/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS = -O3 -I../../ -std=c++17 -DRTNEURAL_DEFAULT_ALIGNMENT=16 +CXXFLAGS = -O3 -I../../ -std=c++17 -DRTNEURAL_DEFAULT_ALIGNMENT=16 -DRTNEURAL_NAMESPACE=RTNeural # Extra flags for compiling with Eigen backend # CXXFLAGS += -DRTNEURAL_USE_EIGEN=1 -I../../modules/Eigen