• Encode a map from names to weight values as an ArrayBuffer, along with an Array of WeightsManifestEntry as specification of the encoded weights.

    This function does not perform sharding.

    This function is the reverse of decodeWeights.

    Parameters

    • tensors: NamedTensorMap | NamedTensor[]

      A map ("dict") from names to tensors.

    • Optionalgroup: WeightGroup

      Group to which the weights belong (optional).

    Returns Promise<{
        data: ArrayBuffer;
        specs: WeightsManifestEntry[];
    }>

    A Promise of

    • A flat ArrayBuffer with all the binary values of the Tensors concatenated.
    • An Array of WeightManifestEntrys, carrying information including tensor names, dtypes and shapes.

    Error: on unsupported tensor dtype.