Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

move frozen model loading to use io handler #196

Merged
merged 2 commits into from
Aug 13, 2018
Merged

move frozen model loading to use io handler #196

merged 2 commits into from
Aug 13, 2018

Conversation

pyu10055
Copy link
Collaborator

@pyu10055 pyu10055 commented Aug 9, 2018

this would allow node.js user to load frozen model from file or http url.

fix tensorflow/tfjs#519


This change is Reviewable

@pyu10055 pyu10055 requested a review from caisq August 9, 2018 01:02
@bileschi
Copy link
Collaborator

bileschi commented Aug 9, 2018

cool!

Copy link
Collaborator

@caisq caisq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @pyu10055 and @caisq)


src/executor/frozen_model.ts, line 35 at r1 (raw file):

  private handler: tfc.io.IOHandler;

Just a comment, no immediate action required: I found it perhaps a little strange that FrozenModel needs to be tied to an IOHandler. This means that a FrozenModel is and will always be loaded from elsewhere, i.e., not built in tfjs per se. Is that the case? If not, maybe it'll be good to refactor the IOHandler out of the class.


src/executor/frozen_model.ts, line 105 at r1 (raw file):

new Uint8Array(artifacts.modelTopology as ArrayBuffer)

Does this make a copy of the buffer or reuse it? If the former, it'll be nice to find a way to avoid it for performance reasons.

Copy link
Collaborator Author

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @pyu10055)


src/executor/frozen_model.ts, line 35 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
  private handler: tfc.io.IOHandler;

Just a comment, no immediate action required: I found it perhaps a little strange that FrozenModel needs to be tied to an IOHandler. This means that a FrozenModel is and will always be loaded from elsewhere, i.e., not built in tfjs per se. Is that the case? If not, maybe it'll be good to refactor the IOHandler out of the class.

I don't see frozen model will be generated directly by tfjs in near future. We can refactor it out, when there is such a need.


src/executor/frozen_model.ts, line 105 at r1 (raw file):

Previously, caisq (Shanqing Cai) wrote…
new Uint8Array(artifacts.modelTopology as ArrayBuffer)

Does this make a copy of the buffer or reuse it? If the former, it'll be nice to find a way to avoid it for performance reasons.

It should not be any copy, they should share the underlying buffer.

@pyu10055 pyu10055 merged commit f7256b6 into master Aug 13, 2018
@pyu10055 pyu10055 deleted the io_handler branch August 13, 2018 22:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants