diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 08:14:45 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 08:14:45 +0800 |
commit | cccccbf6cca94a3eaf813b4468453160e91c332b (patch) | |
tree | 23418cb73a10ae3b0688681a7f0ba9b06424583e /src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base | |
download | tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.gz tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.bz2 tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.zip |
First commit
Diffstat (limited to 'src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base')
-rw-r--r-- | src/CuTNetLib/.svn/text-base/cuSharedLinearity.h.svn-base | 85 |
1 files changed, 85 insertions, 0 deletions
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 |