Skip to content

Commit b404cd4

Browse files
authored
Merge pull request #10 from robertsulej/patch-2
read files w/o border type saved
2 parents 3663313 + d07ec3d commit b404cd4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

keras_model.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ void keras::LayerConv2D::load_weights(std::ifstream &fin) {
4040
char tmp_char = ' ';
4141
string tmp_str = "";
4242
float tmp_float;
43+
bool skip = false;
4344
fin >> m_kernels_cnt >> m_depth >> m_rows >> m_cols >> m_border_mode;
45+
if (m_border_mode == "[") { m_border_mode = "valid"; skip = true; }
46+
4447
cout << "LayerConv2D " << m_kernels_cnt << "x" << m_depth << "x" << m_rows <<
4548
"x" << m_cols << " border_mode " << m_border_mode << endl;
4649
// reading kernel weights
@@ -49,7 +52,8 @@ void keras::LayerConv2D::load_weights(std::ifstream &fin) {
4952
for(int d = 0; d < m_depth; ++d) {
5053
vector<vector<float> > tmp_single_depth;
5154
for(int r = 0; r < m_rows; ++r) {
52-
fin >> tmp_char; // for '['
55+
if (!skip) { fin >> tmp_char; } // for '['
56+
else { skip = false; }
5357
vector<float> tmp_row;
5458
for(int c = 0; c < m_cols; ++c) {
5559
fin >> tmp_float;

0 commit comments

Comments
 (0)