Options
All
  • Public
  • Public/Protected
  • All
Menu

A Tensorflow or ONNX model.

Does not store the model directly. The model is stored in a WebWorker which this class internally accesses via an ID.

Hierarchy

  • Model

Index

Methods

destroy

  • destroy(): Promise<void>
  • Removes all references to the internal model allowing it to be garbage collected.

    Returns Promise<void>

get_metadata

  • Gets metadata of the model.

    Returns Promise<Metadata>

    An object corresponding to the key "metadata_props" of an ONNX model, or an empty object for a TF model.

predict

  • Runs the model on the given input.

    Parameters

    • inputs: Tensor[]

      List of input tensors.

    Returns Promise<Tensor[]>

    Promise for a list of output tensors.

predict_one

  • Runs the model on a single input tensor. This method is provided as convenience method for interfacing with Rust WASM, since arrays of custom objects are not supported yet.

    Parameters

    • input: Tensor

      a single input tensor.

    Returns Promise<Tensor>

    The first output tensor.

Static load

  • Loads a model.

    Parameters

    • url: string

      The URL to load the model from. Will be passed to fetch.

    • Optional options: Options

      Additional options. See Options for details.

    Returns Promise<Model>

Legend

  • Constructor
  • Property
  • Method
  • Static method

Generated using TypeDoc