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 /src/CuTNetLib/cuMisc.h | |
parent | 094828d59df3931dfced69c59cbb538d6b0f1d99 (diff) | |
download | tnet-0653afe62c109f333677f9fd90d19d4727e7cca5.tar.gz tnet-0653afe62c109f333677f9fd90d19d4727e7cca5.tar.bz2 tnet-0653afe62c109f333677f9fd90d19d4727e7cca5.zip |
Supporting const rev.
Diffstat (limited to 'src/CuTNetLib/cuMisc.h')
-rw-r--r-- | src/CuTNetLib/cuMisc.h | 42 |
1 files changed, 21 insertions, 21 deletions
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); } |