Skip to content

Commit 45a7ccf

Browse files
committed
LSTM: Use new serialization API
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent f4449ba commit 45a7ccf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lstm/lstm.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void LSTM::DebugWeights() {
206206
// Writes to the given file. Returns false in case of error.
207207
bool LSTM::Serialize(TFile* fp) const {
208208
if (!Network::Serialize(fp)) return false;
209-
if (fp->FWrite(&na_, sizeof(na_), 1) != 1) return false;
209+
if (!fp->Serialize(&na_)) return false;
210210
for (int w = 0; w < WT_COUNT; ++w) {
211211
if (w == GFS && !Is2D()) continue;
212212
if (!gate_weights_[w].Serialize(IsTraining(), fp)) return false;
@@ -218,7 +218,7 @@ bool LSTM::Serialize(TFile* fp) const {
218218
// Reads from the given file. Returns false in case of error.
219219

220220
bool LSTM::DeSerialize(TFile* fp) {
221-
if (fp->FReadEndian(&na_, sizeof(na_), 1) != 1) return false;
221+
if (!fp->DeSerialize(&na_)) return false;
222222
if (type_ == NT_LSTM_SOFTMAX) {
223223
nf_ = no_;
224224
} else if (type_ == NT_LSTM_SOFTMAX_ENCODED) {

0 commit comments

Comments
 (0)