diff --git a/opennn/dynamic_tensor.h b/opennn/dynamic_tensor.h index e88ab84c7..9084ee9b8 100644 --- a/opennn/dynamic_tensor.h +++ b/opennn/dynamic_tensor.h @@ -55,7 +55,26 @@ class DynamicTensor { { // const Tensor different_dimensions = (dimensions != other.dimensions).all(); -// if(different_dimensions(0)) + bool different_dimensions = false; + + if(dimensions.size() != other.dimensions.size()) + { + different_dimensions = true; + } + + if(!different_dimensions) + { + for(Index i = 0; i < dimensions.size(); i++) + { + if(dimensions(i) != other.dimensions(i)) + { + different_dimensions = true; + break; + } + } + } + + if(different_dimensions) { dimensions = other.dimensions; } @@ -77,11 +96,23 @@ class DynamicTensor { bool operator != (DynamicTensor& other) { -// if((dimensions != other.dimensions)(0)) + +// if(!(dimensions == other.dimensions).all()(0)) // { // return true; // } + if(dimensions.size() != other.dimensions.size()) + { + return true; + } + + for(Index i = 0; i < dimensions.size(); i++) + { + if(dimensions(i) != other.dimensions(i)) + return true; + } + const Tensor size = dimensions.prod(); for(Index i = 0; i < size(0); i++) diff --git a/opennn/kmeans.cpp b/opennn/kmeans.cpp index b32dad0ba..62ad3fa3a 100755 --- a/opennn/kmeans.cpp +++ b/opennn/kmeans.cpp @@ -25,9 +25,9 @@ #include "../../opennn/opennn/opennn.h" -using namespace OpenNN; +using namespace opennn; -namespace OpenNN +namespace opennn { diff --git a/opennn/kmeans.h b/opennn/kmeans.h index 8ca362e14..ed47a3f91 100755 --- a/opennn/kmeans.h +++ b/opennn/kmeans.h @@ -30,16 +30,12 @@ // System includes -//#include -//#include //#include -//#include //#include //#include //#include //#include //#include "unsupported/Eigen/CXX11/Tensor" -//#include "config.h" // OpenNN includes @@ -50,7 +46,7 @@ using opennn::type; using Eigen::Index; using namespace std; -namespace OpenNN +namespace opennn { class KMeans diff --git a/opennn/tensor_utilities.cpp b/opennn/tensor_utilities.cpp index 0a0a1c74c..70b1818ce 100644 --- a/opennn/tensor_utilities.cpp +++ b/opennn/tensor_utilities.cpp @@ -10,7 +10,6 @@ #define GET_VARIABLE_NAME(Variable) (#Variable) - namespace opennn { diff --git a/opennn/tensor_utilities.h b/opennn/tensor_utilities.h index 02b69d266..b44688f3c 100644 --- a/opennn/tensor_utilities.h +++ b/opennn/tensor_utilities.h @@ -13,12 +13,16 @@ #include #include #include +<<<<<<< HEAD //#include +======= +>>>>>>> 201a5d775f04a2bcf0df2e97242cffcc75575a1e // OpenNN includes #include "config.h" #include "opennn_strings.h" +#include "statistics.h" #include "../eigen/unsupported/Eigen/KroneckerProduct"