From 56387520aea64d4e1305528db3d27923edf8f080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20M=C3=A5rtensson?= Date: Fri, 9 Mar 2018 19:48:28 +0100 Subject: [PATCH] Add an adjustment initialization parameter Since keras isn't fully featured, and there are some inconsistencies between versions that are not yet handled, this allows us to modify the modelConfig object during load and resolve such version inconsistencies manually. --- src/Model.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Model.js b/src/Model.js index 9cfb585d..3613cfcb 100644 --- a/src/Model.js +++ b/src/Model.js @@ -28,6 +28,7 @@ export default class Model { */ constructor(config = {}) { const { + adjustment = null, filepath = null, headers = {}, filesystem = false, @@ -40,6 +41,9 @@ export default class Model { if (!filepath) { throw new Error('[Model] path to protobuf-serialized model definition file is missing.') } + + this.adjustment = adjustment; + this.filepath = filepath // HTTP(S) headers used during data fetching @@ -143,6 +147,9 @@ export default class Model { console.log(err) this._interrupt() } + + this.modelConfig = this.adjustment(this.modelConfig); + this.events.emit('loadingProgress', 100) // build directed acyclic graph