diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 11:15:21 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 11:15:21 +0800 |
commit | 0653afe62c109f333677f9fd90d19d4727e7cca5 (patch) | |
tree | cb9398f27458348c9f1b43fb1a734ded16a5507a | |
parent | 094828d59df3931dfced69c59cbb538d6b0f1d99 (diff) | |
download | tnet-0653afe62c109f333677f9fd90d19d4727e7cca5.tar.gz tnet-0653afe62c109f333677f9fd90d19d4727e7cca5.tar.bz2 tnet-0653afe62c109f333677f9fd90d19d4727e7cca5.zip |
Supporting const rev.
21 files changed, 56 insertions, 55 deletions
diff --git a/src/CuTNetLib/cuActivation.o b/src/CuTNetLib/cuActivation.o Binary files differnew file mode 100644 index 0000000..3e78f77 --- /dev/null +++ b/src/CuTNetLib/cuActivation.o diff --git a/src/CuTNetLib/cuBiasedLinearity.o b/src/CuTNetLib/cuBiasedLinearity.o Binary files differnew file mode 100644 index 0000000..05d3438 --- /dev/null +++ b/src/CuTNetLib/cuBiasedLinearity.o diff --git a/src/CuTNetLib/cuBlockArray.o b/src/CuTNetLib/cuBlockArray.o Binary files differnew file mode 100644 index 0000000..14bffe2 --- /dev/null +++ b/src/CuTNetLib/cuBlockArray.o diff --git a/src/CuTNetLib/cuCache.o b/src/CuTNetLib/cuCache.o Binary files differnew file mode 100644 index 0000000..9e7f457 --- /dev/null +++ b/src/CuTNetLib/cuCache.o diff --git a/src/CuTNetLib/cuCompDisc.cc b/src/CuTNetLib/cuCompDisc.cc index 2336a86..4c31f58 100644 --- a/src/CuTNetLib/cuCompDisc.cc +++ b/src/CuTNetLib/cuCompDisc.cc @@ -92,7 +92,7 @@ namespace TNet void CuCompound:: - PropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + PropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) { int iLoc=0,oLoc=0; CuMatrix<BaseFloat> In; @@ -109,7 +109,7 @@ namespace TNet void CuCompound:: - BackpropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + BackpropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) { int iLoc=0,oLoc=0; CuMatrix<BaseFloat> In; diff --git a/src/CuTNetLib/cuCompDisc.h b/src/CuTNetLib/cuCompDisc.h index 5b3232e..937b785 100644 --- a/src/CuTNetLib/cuCompDisc.h +++ b/src/CuTNetLib/cuCompDisc.h @@ -110,12 +110,12 @@ namespace TNet { void ReadFromStream(std::istream& rIn); void WriteToStream(std::ostream& rOut); - int GetInSect() + int GetInSect() const { return inID.size(); } - int GetOutSect() + int GetOutSect() const { return outID.size(); } @@ -139,31 +139,31 @@ namespace TNet { } /// IO Data getters - CuMatrix<BaseFloat>& GetInput(int pos=0) + const CuMatrix<BaseFloat>& GetInput(int pos=0) { if (preComp!=NULL) return preComp->GetOutput(pos); return *mpInput; } - CuMatrix<BaseFloat>& GetOutput(int pos=0) + const CuMatrix<BaseFloat>& GetOutput(int pos=0) { CuComponent* pComp=FindOutput(pos); return pComp->GetOutput(pos); } - CuMatrix<BaseFloat>& GetErrorInput(int pos=0) + const CuMatrix<BaseFloat>& GetErrorInput(int pos=0) { if (nxtComp!=NULL) return nxtComp->GetErrorOutput(pos); return *mpErrorInput; } - CuMatrix<BaseFloat>& GetErrorOutput(int pos=0) + const CuMatrix<BaseFloat>& GetErrorOutput(int pos=0) { CuComponent* pComp=FindInput(pos); return pComp->GetErrorOutput(pos); } /// Set input vector (bind with the preceding NetworkComponent) - void SetInput(CuMatrix<BaseFloat>& rInput,int pos=0) + void SetInput(const CuMatrix<BaseFloat>& rInput,int pos=0) { if (pos==0) mpInput=&rInput; @@ -171,7 +171,7 @@ namespace TNet { pComp->SetInput(rInput,pos); } /// Set error input vector (bind with the following NetworkComponent) - void SetErrorInput(CuMatrix<BaseFloat>& rErrorInput,int pos=0) + void SetErrorInput(const CuMatrix<BaseFloat>& rErrorInput,int pos=0) { if (pos==0) mpErrorInput=&rErrorInput; @@ -238,8 +238,8 @@ namespace TNet { void ReadFromStream(std::istream& rIn); void WriteToStream(std::ostream& rOut); - void PropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); - void BackpropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); + void PropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); + void BackpropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); protected: diff --git a/src/CuTNetLib/cuCompDisc.o b/src/CuTNetLib/cuCompDisc.o Binary files differnew file mode 100644 index 0000000..764f3b1 --- /dev/null +++ b/src/CuTNetLib/cuCompDisc.o diff --git a/src/CuTNetLib/cuComponent.h b/src/CuTNetLib/cuComponent.h index 6cc8462..fc9666c 100644 --- a/src/CuTNetLib/cuComponent.h +++ b/src/CuTNetLib/cuComponent.h @@ -85,6 +85,7 @@ namespace TNet { } ComponentType; typedef std::vector< CuMatrix<BaseFloat>* > MatrixPtrVec; + typedef std::vector< const CuMatrix<BaseFloat>* > ConstMatrixPtrVec; ////////////////////////////////////////////////////////////// // Constructor & Destructor @@ -118,20 +119,20 @@ namespace TNet { void SetNext(CuComponent* pNxt); /// Return the number of different inputs for complex component - int GetInSect(); + int GetInSect() const; /// Return the number of different outputs for complex component - int GetOutSect(); + int GetOutSect() const; /// IO Data getters - CuMatrix<BaseFloat>& GetInput(int pos=0); - CuMatrix<BaseFloat>& GetOutput(int pos=0); - CuMatrix<BaseFloat>& GetErrorInput(int pos=0); - CuMatrix<BaseFloat>& GetErrorOutput(int pos=0); + const CuMatrix<BaseFloat>& GetInput(int pos=0); + const CuMatrix<BaseFloat>& GetOutput(int pos=0); + const CuMatrix<BaseFloat>& GetErrorInput(int pos=0); + const CuMatrix<BaseFloat>& GetErrorOutput(int pos=0); /// Set input vector (bind with the preceding NetworkComponent) - void SetInput(CuMatrix<BaseFloat>& rInput,int pos=0); + void SetInput(const CuMatrix<BaseFloat>& rInput,int pos=0); /// Set error input vector (bind with the following NetworkComponent) - void SetErrorInput(CuMatrix<BaseFloat>& rErrorInput,int pos=0); + void SetErrorInput(const CuMatrix<BaseFloat>& rErrorInput,int pos=0); /// Perform forward pass propagateion Input->Output, /// wrapper for the PropagateFnc method @@ -146,9 +147,9 @@ namespace TNet { virtual void WriteToStream(std::ostream& rOut) { } /// Public wrapper for PropagateFnc - void PropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); + void PropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); /// Public wrapper for BackpropagateFnc - void BackpropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); + void BackpropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y); /////////////////////////////////////////////////////////////// @@ -171,8 +172,8 @@ namespace TNet { size_t mNInputs; ///< Size of input vectors size_t mNOutputs; ///< Size of output vectors - CuMatrix<BaseFloat>* mpInput; ///< inputs are NOT OWNED by component - CuMatrix<BaseFloat>* mpErrorInput;///< inputs are NOT OWNED by component + const CuMatrix<BaseFloat>* mpInput; ///< inputs are NOT OWNED by component + const CuMatrix<BaseFloat>* mpErrorInput;///< inputs are NOT OWNED by component CuMatrix<BaseFloat> mOutput; ///< outputs are OWNED by component CuMatrix<BaseFloat> mErrorOutput; ///< outputs are OWNED by component @@ -316,7 +317,7 @@ namespace TNet { inline void CuComponent:: - SetInput(CuMatrix<BaseFloat>& rInput,int pos) + SetInput(const CuMatrix<BaseFloat>& rInput,int pos) { mpInput = &rInput; } @@ -324,12 +325,12 @@ namespace TNet { inline void CuComponent:: - SetErrorInput(CuMatrix<BaseFloat>& rErrorInput,int pos) + SetErrorInput(const CuMatrix<BaseFloat>& rErrorInput,int pos) { mpErrorInput = &rErrorInput; } - inline CuMatrix<BaseFloat>& + inline const CuMatrix<BaseFloat>& CuComponent:: GetInput(int pos) { @@ -337,14 +338,14 @@ namespace TNet { return *mpInput; } - inline CuMatrix<BaseFloat>& + inline const CuMatrix<BaseFloat>& CuComponent:: GetOutput(int pos) { return mOutput; } - inline CuMatrix<BaseFloat>& + inline const CuMatrix<BaseFloat>& CuComponent:: GetErrorInput(int pos) { @@ -352,7 +353,7 @@ namespace TNet { return *mpErrorInput; } - inline CuMatrix<BaseFloat>& + inline const CuMatrix<BaseFloat>& CuComponent:: GetErrorOutput(int pos) { @@ -375,14 +376,14 @@ namespace TNet { inline int CuComponent:: - GetInSect() + GetInSect() const { return 1; } inline int CuComponent:: - GetOutSect() + GetOutSect() const { return 1; } @@ -403,13 +404,13 @@ namespace TNet { inline void CuComponent:: - PropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + PropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) { PropagateFnc(X,Y); } inline void CuComponent:: - BackpropagateF(CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) + BackpropagateF(const CuMatrix<BaseFloat>& X, CuMatrix<BaseFloat>& Y) { BackpropagateFnc(X,Y); } diff --git a/src/CuTNetLib/cuConcatenate.o b/src/CuTNetLib/cuConcatenate.o Binary files differnew file mode 100644 index 0000000..6dfd15d --- /dev/null +++ b/src/CuTNetLib/cuConcatenate.o diff --git a/src/CuTNetLib/cuDiscreteLinearity.o b/src/CuTNetLib/cuDiscreteLinearity.o Binary files differnew file mode 100644 index 0000000..a7eeb56 --- /dev/null +++ b/src/CuTNetLib/cuDiscreteLinearity.o diff --git a/src/CuTNetLib/cuLinearity.o b/src/CuTNetLib/cuLinearity.o Binary files differnew file mode 100644 index 0000000..31c9974 --- /dev/null +++ b/src/CuTNetLib/cuLinearity.o diff --git a/src/CuTNetLib/cuMisc.h b/src/CuTNetLib/cuMisc.h index 7319adf..b93a983 100644 --- a/src/CuTNetLib/cuMisc.h +++ b/src/CuTNetLib/cuMisc.h @@ -148,19 +148,19 @@ namespace TNet { mOutput.Init(*mpInput); } - int GetOutSect() + int GetOutSect() const { return size; } - CuMatrix<BaseFloat>& GetErrorInput(int pos=0) + const CuMatrix<BaseFloat>& GetErrorInput(int pos=0) { if (pos>=0 && pos<size) return *ErrInputVec[pos]; return *ErrInputVec[0]; } - void SetErrorInput(CuMatrix<BaseFloat>& rErrorInput,int pos=0) + void SetErrorInput(const CuMatrix<BaseFloat>& rErrorInput,int pos=0) { if (pos==0) mpErrorInput=&rErrorInput; @@ -181,7 +181,7 @@ namespace TNet { } int size; - MatrixPtrVec ErrInputVec; + ConstMatrixPtrVec ErrInputVec; Vector<BaseFloat> Scale; }; @@ -227,13 +227,13 @@ namespace TNet { mErrorOutput.Init(*mpErrorInput); } - int GetInSect() + int GetInSect() const { return size; } /// IO Data getters - CuMatrix<BaseFloat>& GetInput(int pos=0) + const CuMatrix<BaseFloat>& GetInput(int pos=0) { if (pos>=0 && pos<size) return *InputVec[pos]; @@ -241,7 +241,7 @@ namespace TNet { } /// Set input vector (bind with the preceding NetworkComponent) - void SetInput(CuMatrix<BaseFloat>& rInput,int pos=0) + void SetInput(const CuMatrix<BaseFloat>& rInput,int pos=0) { if (pos==0) mpInput=&rInput; @@ -264,7 +264,7 @@ namespace TNet { } int size; - MatrixPtrVec InputVec; + ConstMatrixPtrVec InputVec; }; /** @@ -289,7 +289,7 @@ namespace TNet { const char* GetName() const { return "<divide>"; } - int GetOutSect() + int GetOutSect() const { return size; } @@ -345,7 +345,7 @@ namespace TNet { int size; MatrixPtrVec OutputVec; - MatrixPtrVec ErrorInputVec; + ConstMatrixPtrVec ErrorInputVec; std::vector<int> SectLen; }; @@ -372,7 +372,7 @@ namespace TNet { const char* GetName() const { return "<merge>"; } - int GetInSect() + int GetInSect() const { return size; } @@ -428,7 +428,7 @@ namespace TNet { int size; - MatrixPtrVec InputVec; + ConstMatrixPtrVec InputVec; MatrixPtrVec ErrorOutputVec; std::vector<int> SectLen; @@ -456,12 +456,12 @@ namespace TNet { const char* GetName() const { return "<reorder>"; } - int GetInSect() + int GetInSect() const { return size; } - int GetOutSect() + int GetOutSect() const { return size; } @@ -505,30 +505,30 @@ namespace TNet { } /// IO Data getters - CuMatrix<BaseFloat>& GetInput(int pos=0) + const CuMatrix<BaseFloat>& GetInput(int pos=0) { return PipeVec[pos]->GetInput(); } - CuMatrix<BaseFloat>& GetOutput(int pos=0) + const CuMatrix<BaseFloat>& GetOutput(int pos=0) { return PipeVec[Order[pos]]->GetOutput(); } - CuMatrix<BaseFloat>& GetErrorInput(int pos=0) - { + const CuMatrix<BaseFloat>& GetErrorInput(int pos=0) + { return PipeVec[Order[pos]]->GetErrorInput(); } - CuMatrix<BaseFloat>& GetErrorOutput(int pos=0) + const CuMatrix<BaseFloat>& GetErrorOutput(int pos=0) { return PipeVec[pos]->GetErrorOutput(); } /// Set input vector (bind with the preceding NetworkComponent) - void SetInput(CuMatrix<BaseFloat>& rInput,int pos=0) + void SetInput(const CuMatrix<BaseFloat>& rInput,int pos=0) { PipeVec[pos]->SetInput(rInput); } /// Set error input vector (bind with the following NetworkComponent) - void SetErrorInput(CuMatrix<BaseFloat>& rErrorInput,int pos=0) + void SetErrorInput(const CuMatrix<BaseFloat>& rErrorInput,int pos=0) { PipeVec[Order[pos]]->SetErrorInput(rErrorInput); } diff --git a/src/CuTNetLib/cuNetwork.o b/src/CuTNetLib/cuNetwork.o Binary files differnew file mode 100644 index 0000000..7f3568f --- /dev/null +++ b/src/CuTNetLib/cuNetwork.o diff --git a/src/CuTNetLib/cuObjectiveFunction.o b/src/CuTNetLib/cuObjectiveFunction.o Binary files differnew file mode 100644 index 0000000..00eaacd --- /dev/null +++ b/src/CuTNetLib/cuObjectiveFunction.o diff --git a/src/CuTNetLib/cuRbm.o b/src/CuTNetLib/cuRbm.o Binary files differnew file mode 100644 index 0000000..5f84017 --- /dev/null +++ b/src/CuTNetLib/cuRbm.o diff --git a/src/CuTNetLib/cuRbmSparse.o b/src/CuTNetLib/cuRbmSparse.o Binary files differnew file mode 100644 index 0000000..b56c669 --- /dev/null +++ b/src/CuTNetLib/cuRbmSparse.o diff --git a/src/CuTNetLib/cuRecurrent.o b/src/CuTNetLib/cuRecurrent.o Binary files differnew file mode 100644 index 0000000..73969fe --- /dev/null +++ b/src/CuTNetLib/cuRecurrent.o diff --git a/src/CuTNetLib/cuSharedLinearity.o b/src/CuTNetLib/cuSharedLinearity.o Binary files differnew file mode 100644 index 0000000..175c607 --- /dev/null +++ b/src/CuTNetLib/cuSharedLinearity.o diff --git a/src/CuTNetLib/cuSparseLinearity.o b/src/CuTNetLib/cuSparseLinearity.o Binary files differnew file mode 100644 index 0000000..24547a2 --- /dev/null +++ b/src/CuTNetLib/cuSparseLinearity.o diff --git a/src/CuTNetLib/cuUpdatableBias.o b/src/CuTNetLib/cuUpdatableBias.o Binary files differnew file mode 100644 index 0000000..288189d --- /dev/null +++ b/src/CuTNetLib/cuUpdatableBias.o diff --git a/src/CuTNetLib/libCuTNet.a b/src/CuTNetLib/libCuTNet.a Binary files differnew file mode 100644 index 0000000..163a1d8 --- /dev/null +++ b/src/CuTNetLib/libCuTNet.a |