diff options
Diffstat (limited to 'src/TNetLib/.svn/text-base/BlockArray.h.svn-base')
-rw-r--r-- | src/TNetLib/.svn/text-base/BlockArray.h.svn-base | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/TNetLib/.svn/text-base/BlockArray.h.svn-base b/src/TNetLib/.svn/text-base/BlockArray.h.svn-base new file mode 100644 index 0000000..e6a8657 --- /dev/null +++ b/src/TNetLib/.svn/text-base/BlockArray.h.svn-base @@ -0,0 +1,85 @@ +#ifndef _BLOCK_ARRAY_H_ +#define _BLOCK_ARRAY_H_ + + +#include "Component.h" + +#include "Matrix.h" +#include "Vector.h" + + +namespace TNet { + + class Network; + + class BlockArray : public Component + { + public: + + BlockArray(size_t nInputs, size_t nOutputs, Component *pPred); + ~BlockArray(); + + ComponentType GetType() const; + const char* GetName() const; + + void PropagateFnc(const Matrix<BaseFloat>& X, Matrix<BaseFloat>& Y); + void BackpropagateFnc(const Matrix<BaseFloat>& X, Matrix<BaseFloat>& Y); + + void Update(); + + void ReadFromStream(std::istream& rIn); + void WriteToStream(std::ostream& rOut); + + //:TODO: + Component* Clone() const { KALDI_ERR << "Unimplemented"; } + + protected: + std::vector<Network*> mBlocks; ///< vector with networks, one network is one block + size_t mNBlocks; + }; + + + + + //////////////////////////////////////////////////////////////////////////// + // INLINE FUNCTIONS + // BlockArray:: + inline + BlockArray:: + BlockArray(size_t nInputs, size_t nOutputs, Component *pPred) + : Component(nInputs, nOutputs, pPred), + mNBlocks(0) + { } + + + inline + BlockArray:: + ~BlockArray() + { + for(int i=0; i<mBlocks.size(); i++) { + delete mBlocks[i]; + } + mBlocks.clear(); + } + + inline Component::ComponentType + BlockArray:: + GetType() const + { + return Component::BLOCK_ARRAY; + } + + inline const char* + BlockArray:: + GetName() const + { + return "<blockarray>"; + } + + + +} //namespace + + + +#endif |