From 0653afe62c109f333677f9fd90d19d4727e7cca5 Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Mon, 14 Apr 2014 11:15:21 +0800 Subject: Supporting const rev. --- src/CuTNetLib/cuCompDisc.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/CuTNetLib/cuCompDisc.h') 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& GetInput(int pos=0) + const CuMatrix& GetInput(int pos=0) { if (preComp!=NULL) return preComp->GetOutput(pos); return *mpInput; } - CuMatrix& GetOutput(int pos=0) + const CuMatrix& GetOutput(int pos=0) { CuComponent* pComp=FindOutput(pos); return pComp->GetOutput(pos); } - CuMatrix& GetErrorInput(int pos=0) + const CuMatrix& GetErrorInput(int pos=0) { if (nxtComp!=NULL) return nxtComp->GetErrorOutput(pos); return *mpErrorInput; } - CuMatrix& GetErrorOutput(int pos=0) + const CuMatrix& GetErrorOutput(int pos=0) { CuComponent* pComp=FindInput(pos); return pComp->GetErrorOutput(pos); } /// Set input vector (bind with the preceding NetworkComponent) - void SetInput(CuMatrix& rInput,int pos=0) + void SetInput(const CuMatrix& 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& rErrorInput,int pos=0) + void SetErrorInput(const CuMatrix& 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& X, CuMatrix& Y); - void BackpropagateF(CuMatrix& X, CuMatrix& Y); + void PropagateF(const CuMatrix& X, CuMatrix& Y); + void BackpropagateF(const CuMatrix& X, CuMatrix& Y); protected: -- cgit v1.2.3-70-g09d2