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

Function bundleResourceIO

tfjs-react-native/src/bundle_resource_io.ts:169–185  ·  view source on GitHub ↗
(
    modelJson: io.ModelJSON, modelWeightsId: number|number[])

Source from the content-addressed store, hash-verified

167 * @doc {heading: 'Models', subheading: 'IOHandlers'}
168 */
169export function bundleResourceIO(
170 modelJson: io.ModelJSON, modelWeightsId: number|number[]): io.IOHandler {
171 if (typeof modelJson !== 'object') {
172 throw new Error(
173 'modelJson must be a JavaScript object (and not a string).\n' +
174 'Have you wrapped your asset path in a require() statement?');
175 }
176
177 if (typeof modelWeightsId === 'string') {
178 throw new Error(
179 'modelWeightsID must be a number or number array.\n' +
180 'Have you wrapped your asset paths in a require() statements?');
181 }
182 const modelWeightsIdArr =
183 Array.isArray(modelWeightsId) ? modelWeightsId : [modelWeightsId];
184 return new BundleResourceHandler(modelJson, modelWeightsIdArr);
185}

Callers 4

localModelRunnerFunction · 0.90
localGraphModelRunnerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…