Function remote_model

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

    Remarks

    This function assumes a server running network.serve_model.

    Example

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

    const model = sm.network.remote_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) => {
    loss_fn(output).backward()
    }).then(() => {
    console.log('backward executed!')
    })

    Returns

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

    Parameters

    • 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