From cccccbf6cca94a3eaf813b4468453160e91c332b Mon Sep 17 00:00:00 2001
From: Joe Zhao <ztuowen@gmail.com>
Date: Mon, 14 Apr 2014 08:14:45 +0800
Subject: First commit

---
 .../.svn/text-base/cuSharedLinearity.h.svn-base    | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base

(limited to 'src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base')

diff --git a/src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base b/src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base
new file mode 100644
index 0000000..4aa022a
--- /dev/null
+++ b/src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base
@@ -0,0 +1,85 @@
+#ifndef _CUSHARED_LINEARITY_H_
+#define _CUSHARED_LINEARITY_H_
+
+
+#include "cuComponent.h"
+#include "cumatrix.h"
+
+
+#include "Matrix.h"
+#include "Vector.h"
+
+
+namespace TNet {
+
+  class CuSharedLinearity : public CuUpdatableComponent
+  {
+    public:
+
+      CuSharedLinearity(size_t nInputs, size_t nOutputs, CuComponent *pPred); 
+      ~CuSharedLinearity();  
+      
+      ComponentType GetType() const;
+      const char* GetName() const;
+
+      void PropagateFnc(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y);
+      void BackpropagateFnc(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y);
+
+      void Update();
+
+      void ReadFromStream(std::istream& rIn);
+      void WriteToStream(std::ostream& rOut);
+
+    protected:
+      CuMatrix<BaseFloat> mLinearity;  ///< Matrix with neuron weights
+      CuVector<BaseFloat> mBias;       ///< Vector with biases
+
+      CuMatrix<BaseFloat> mLinearityCorrection; ///< Matrix for linearity updates
+      CuVector<BaseFloat> mBiasCorrection;      ///< Vector for bias updates
+
+      int mNInstances;
+      CuVector<BaseFloat> mBiasExpand;
+      CuVector<BaseFloat> mBiasCorrectionExpand;
+
+  };
+
+
+
+
+  ////////////////////////////////////////////////////////////////////////////
+  // INLINE FUNCTIONS 
+  // CuSharedLinearity::
+  inline 
+  CuSharedLinearity::
+  CuSharedLinearity(size_t nInputs, size_t nOutputs, CuComponent *pPred)
+    : CuUpdatableComponent(nInputs, nOutputs, pPred), 
+      mNInstances(0)
+  { }
+
+
+  inline
+  CuSharedLinearity::
+  ~CuSharedLinearity()
+  { }
+
+  inline CuComponent::ComponentType
+  CuSharedLinearity::
+  GetType() const
+  {
+    return CuComponent::SHARED_LINEARITY;
+  }
+
+  inline const char*
+  CuSharedLinearity::
+  GetName() const
+  {
+    return "<sharedlinearity>";
+  }
+
+
+
+} //namespace
+
+
+
+#endif
-- 
cgit v1.2.3-70-g09d2