From 675fa7bd44d88db53c5395fe856d5af0465bf8ca Mon Sep 17 00:00:00 2001
From: Konstantin Gizdov <k.gizdov@cern.ch>
Date: Fri, 9 Feb 2018 01:02:02 +0100
Subject: [PATCH 1/3] expose Keras headers

---
 Rec/ChargedProtoANNPID/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Rec/ChargedProtoANNPID/CMakeLists.txt b/Rec/ChargedProtoANNPID/CMakeLists.txt
index 8b5cf1c2266..b1f33776b03 100644
--- a/Rec/ChargedProtoANNPID/CMakeLists.txt
+++ b/Rec/ChargedProtoANNPID/CMakeLists.txt
@@ -30,10 +30,10 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS})
 
 gaudi_add_library(ChargedProtoANNPID-yPIDLib
                   src/yPID/MC15TuneV1/*/*.cpp
-                  NO_PUBLIC_HEADERS)
+                  PUBLIC_HEADERS src/yPID/MC15TuneV1/keras)
 
 gaudi_add_module(ChargedProtoANNPID
-                 src/*.cpp 
+                 src/*.cpp
                  INCLUDE_DIRS ROOT VDT Rec/RecInterfaces
                  LINK_LIBRARIES ROOT VDT MCEvent PhysEvent RecEvent GaudiAlgLib ChargedProtoANNPID-yPIDLib)
 
-- 
GitLab


From 6bbb5361d593ac5638c02ee6331117f6a774e938 Mon Sep 17 00:00:00 2001
From: Konstantin Gizdov <k.gizdov@cern.ch>
Date: Mon, 12 Feb 2018 11:52:04 +0100
Subject: [PATCH 2/3] expose members to inheriting classes

---
 .../src/yPID/MC15TuneV1/keras/keras_model.h   | 28 +++++++++++--------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h b/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h
index 8898bcbdf12..c3225067fbf 100644
--- a/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h
+++ b/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h
@@ -297,7 +297,7 @@ class KerasLayerActivation : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
     ActivationType activation_type_;
 };
 
@@ -311,10 +311,11 @@ class KerasLayerDense : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
     Tensor weights_;
     Tensor biases_;
 
+  private:
     KerasLayerActivation activation_;
 };
 
@@ -328,10 +329,11 @@ class KerasLayerConvolution2d : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
     Tensor weights_;
     Tensor biases_;
 
+  private:
     KerasLayerActivation activation_;
 };
 
@@ -345,7 +347,7 @@ class KerasLayerFlatten : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
 };
 
 class KerasLayerElu : public KerasLayer {
@@ -358,7 +360,7 @@ class KerasLayerElu : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
     float alpha_;
 };
 
@@ -372,7 +374,7 @@ class KerasLayerMaxPooling2d : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
     unsigned int pool_size_j_;
     unsigned int pool_size_k_;
 };
@@ -387,7 +389,7 @@ class KerasLayerLSTM : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
     bool Step(Tensor* x, Tensor* out, Tensor* ht_1, Tensor* ct_1);
 
     Tensor Wi_;
@@ -403,9 +405,11 @@ class KerasLayerLSTM : public KerasLayer {
     Tensor Uo_;
     Tensor bo_;
 
+    bool return_sequences_;
+
+  private:
     KerasLayerActivation innerActivation_;
     KerasLayerActivation activation_;
-    bool return_sequences_;
 };
 
 class KerasLayerEmbedding : public KerasLayer {
@@ -418,12 +422,12 @@ class KerasLayerEmbedding : public KerasLayer {
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-  private:
+  protected:
     Tensor weights_;
 };
 
 class KerasLayerBatchNormalization : public KerasLayer {
-public:
+  public:
     KerasLayerBatchNormalization() {}
 
     virtual ~KerasLayerBatchNormalization() {}
@@ -432,7 +436,7 @@ public:
 
     virtual bool Apply(Tensor* in, Tensor* out) override;
 
-private:
+  protected:
     Tensor gammas_;
     Tensor betas_;
     Tensor running_means_;
@@ -465,7 +469,7 @@ class KerasModel {
 
     virtual bool Apply(Tensor* in, Tensor* out);
 
-  private:
+  protected:
     std::vector<KerasLayer*> layers_;
 };
 
-- 
GitLab


From 82727520aa85e49ec194917cbf3e3e37679cdf0c Mon Sep 17 00:00:00 2001
From: Konstantin Gizdov <kgizdov@gmail.com>
Date: Wed, 28 Feb 2018 17:00:15 +0100
Subject: [PATCH 3/3] allow for activation member inheritance LHCBPS-1769

---
 Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h b/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h
index c3225067fbf..6195797aafd 100644
--- a/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h
+++ b/Rec/ChargedProtoANNPID/src/yPID/MC15TuneV1/keras/keras_model.h
@@ -315,7 +315,6 @@ class KerasLayerDense : public KerasLayer {
     Tensor weights_;
     Tensor biases_;
 
-  private:
     KerasLayerActivation activation_;
 };
 
@@ -333,7 +332,6 @@ class KerasLayerConvolution2d : public KerasLayer {
     Tensor weights_;
     Tensor biases_;
 
-  private:
     KerasLayerActivation activation_;
 };
 
@@ -407,7 +405,6 @@ class KerasLayerLSTM : public KerasLayer {
 
     bool return_sequences_;
 
-  private:
     KerasLayerActivation innerActivation_;
     KerasLayerActivation activation_;
 };
-- 
GitLab