At any given time a single platform is active and represents and implementation of this interface. In practice, a platform is an environment where TensorFlow.js can be executed, e.g. the browser or Node.js.

interface Platform {
    decode(bytes, encoding): string;
    encode(text, encoding): Uint8Array;
    fetch(path, requestInits?, options?): Promise<Response>;
    now(): number;
}

Methods

  • Decode the provided bytes into a string using the provided encoding.

    Parameters

    • bytes: Uint8Array
    • encoding: string

    Returns string

  • Encode the provided string into an array of bytes using the provided encoding.

    Parameters

    • text: string
    • encoding: string

    Returns Uint8Array

  • Makes an HTTP request.

    Parameters

    • path: string

      The URL path to make a request to

    • Optional requestInits: RequestInit
    • Optional options: RequestDetails

    Returns Promise<Response>

  • Returns the current high-resolution time in milliseconds relative to an arbitrary time in the past. It works across different platforms (node.js, browsers).

    Returns number

Generated using TypeDoc