(
pathOrIOHandler: string|io.IOHandler,
options?: io.LoadOptions)
| 246 | * @doc {heading: 'Models', subheading: 'Loading'} |
| 247 | */ |
| 248 | export 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. |
no test coverage detected
searching dependent graphs…