(
modelHandler, loadOptions = {}, state = {})
| 582 | } |
| 583 | |
| 584 | async function tryAllLoadingMethods( |
| 585 | modelHandler, loadOptions = {}, state = {}) { |
| 586 | let model; |
| 587 | // TODO: download weights once |
| 588 | try { |
| 589 | model = await tf.loadGraphModel(modelHandler, loadOptions); |
| 590 | state.modelType = 'GraphModel'; |
| 591 | return model; |
| 592 | } catch (e) { |
| 593 | } |
| 594 | |
| 595 | try { |
| 596 | model = await tf.loadLayersModel(modelHandler, loadOptions); |
| 597 | state.modelType = 'LayersModel'; |
| 598 | return model; |
| 599 | } catch (e) { |
| 600 | } |
| 601 | |
| 602 | throw new Error(`Didn't find a fit loading method for this model.`); |
| 603 | } |
| 604 | |
| 605 | /** |
| 606 | * Load a graph model or a a model composed of Layer objects and record the |
no outgoing calls
no test coverage detected
searching dependent graphs…