Similar to network.tfetch, the await keyword may be used:
constmodel = sm.network.remote_model('localhost:3000') constinput = sm.randn([128]) // await is necessary, as model invocation is asynchronous constoutput = awaitmodel(input) constloss = sm.loss.mse(output, reference) // note the use of the await keyword for the backward pass awaitloss.backward()
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
, theawait
keyword may be used:or chained callbacks:
Returns
An asynchronous function that can be invoked with an input tensor.