Function remote_model

  • Connect to a remote model as if it were a local differentiable function.


    This function assumes a server running network.serve_model.


    Similar to network.tfetch, the await keyword may be used:

    const model ='localhost:3000')
    const input = sm.randn([128])
    // await is necessary, as model invocation is asynchronous
    const output = await model(input)
    const loss = sm.loss.mse(output, reference)
    // note the use of the await keyword for the backward pass
    await loss.backward()

    or chained callbacks:

    model(input).then((output) => {
    }).then(() => {
    console.log('backward executed!')


    An asynchronous function that can be invoked with an input tensor.


    • url: string

      The location of the remote model (must be running network.serve_model).

    • Optional backward_url: string
    • Optional error_handler: any

    Returns ((t: Tensor) => Promise<any>)

      • (t: Tensor): Promise<any>
      • Parameters

        Returns Promise<any>

Generated using TypeDoc