Skip to content

Commit

Permalink
Remove loadGraphModelSync options and add jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsoulanille committed May 19, 2022
1 parent d41214f commit a3438bc
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tfjs-converter/src/executor/graph_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,18 +471,26 @@ export async function loadGraphModel(
return model;
}


/**
* Load a graph model given a synchronous IO handler with a 'load' method.
*
* @param modelSource The `io.IOHandlerSync` that loads the model.
*
* @doc {heading: 'Models', subheading: 'Loading'}
*/

export function loadGraphModelSync(
modelUrl: io.IOHandlerSync,
options: io.LoadOptions = {}): GraphModel<io.IOHandlerSync> {
if (modelUrl == null) {
modelSource: io.IOHandlerSync): GraphModel<io.IOHandlerSync> {
if (modelSource == null) {
throw new Error(
'modelUrl in loadGraphModelSync() cannot be null. Please provide a url ' +
'or an IOHandler that loads the model');
}
if (!modelUrl.load) {
throw new Error(`modelUrl IO Handler ${modelUrl} has no load function`);
if (!modelSource.load) {
throw new Error(`modelUrl IO Handler ${modelSource} has no load function`);
}
const model = new GraphModel(modelUrl, options);
const model = new GraphModel(modelSource);

model.load();
return model;
Expand Down

0 comments on commit a3438bc

Please sign in to comment.