blob: e6a86573b91c633c8e27eae185f4f9f456bd95e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
|