MCPcopy Create free account
hub / github.com/tensorflow/tfjs / tryAllLoadingMethods

Function tryAllLoadingMethods

e2e/benchmarks/model_config.js:584–603  ·  view source on GitHub ↗
(
    modelHandler, loadOptions = {}, state = {})

Source from the content-addressed store, hash-verified

582}
583
584async 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

Callers 1

loadModelByUrlWithStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…