MCPcopy
hub / github.com/tensorflow/tfjs / loadLayersModel

Function loadLayersModel

tfjs-layers/src/models.ts:248–270  ·  view source on GitHub ↗
(
    pathOrIOHandler: string|io.IOHandler,
    options?: io.LoadOptions)

Source from the content-addressed store, hash-verified

246 * @doc {heading: 'Models', subheading: 'Loading'}
247 */
248export async function loadLayersModel(
249 pathOrIOHandler: string|io.IOHandler,
250 options?: io.LoadOptions): Promise<LayersModel> {
251 if (options == null) {
252 options = {};
253 }
254 if (typeof pathOrIOHandler === 'string') {
255 const handlers = io.getLoadHandlers(pathOrIOHandler, options);
256 if (handlers.length === 0) {
257 // For backward compatibility: if no load handler can be found,
258 // assume it is a relative http path.
259 // TODO(cais): Reformat the args into a single `LoadOptions` once the core
260 // is refactored.
261 handlers.push(io.browserHTTPRequest(pathOrIOHandler, options));
262 } else if (handlers.length > 1) {
263 throw new ValueError(
264 `Found more than one (${handlers.length}) load handlers for ` +
265 `URL '${pathOrIOHandler}'`);
266 }
267 pathOrIOHandler = handlers[0];
268 }
269 return loadLayersModelFromIOHandler(pathOrIOHandler, undefined, options);
270}
271
272/**
273 * Load a model and optionally its weights, using an IOHandler object.

Callers 1

models_test.tsFile · 0.90

Calls 3

getLoadHandlersMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…