/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ import { io } from '@tensorflow/tfjs-core'; /** * Factory function for BundleResource IOHandler. * * This `IOHandler` only supports `load`. It is designed to support * loading models that have been statically bundled (at compile time) * with an app. * * This IOHandler is not compatible with managed expo apps. * * ```js * const modelJson = require('../path/to/model.json'); * const modelWeights = require('../path/to/model_weights.bin'); * async function bundleResourceIOExample() { * const model = * await tf.loadLayersModel(bundleResourceIO(modelJson, modelWeights)); * * const res = model.predict(tf.randomNormal([1, 28, 28, 1])) as tf.Tensor; * } * ``` * * @param modelJson The JSON object for the serialized model. * @param modelWeightsId Identifier(s) for the model's weights files. This is * generally a resourceId or a path to the resource in the app package. * This is typically obtained with a `require` statement. Can also be an array * of such ids if the model has multiple shards. * * See * facebook.github.io/react-native/docs/images#static-non-image-resources * for more details on how to include static resources into your react-native * app including how to configure `metro` to bundle `.bin` files. * * @returns An instance of `IOHandler` * * @doc {heading: 'Models', subheading: 'IOHandlers'} */ export declare function bundleResourceIO(modelJson: io.ModelJSON, modelWeightsId: number | number[]): io.IOHandler;