summaryrefslogtreecommitdiff
path: root/src/CuTNetLib/cuMisc.h
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2014-04-14 11:18:58 +0800
committerJoe Zhao <ztuowen@gmail.com>2014-04-14 11:18:58 +0800
commitf98b9b720f0f5c511f5cb735f0456f0d5fe3c791 (patch)
treecb9398f27458348c9f1b43fb1a734ded16a5507a /src/CuTNetLib/cuMisc.h
parentcccccbf6cca94a3eaf813b4468453160e91c332b (diff)
downloadtnet-f98b9b720f0f5c511f5cb735f0456f0d5fe3c791.tar.gz
tnet-f98b9b720f0f5c511f5cb735f0456f0d5fe3c791.tar.bz2
tnet-f98b9b720f0f5c511f5cb735f0456f0d5fe3c791.zip
Supporting const rev.
Diffstat (limited to 'src/CuTNetLib/cuMisc.h')
-rw-r--r--src/CuTNetLib/cuMisc.h42
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);
}