Contents

run(inputs:states:outputViews:)

Runs the function on the provided input arrays and returns the output values.

Declaration

func run(inputs: [String : NDArray], states: consuming InferenceFunction.MutableViews = MutableViews(), outputViews: consuming InferenceFunction.MutableViews = MutableViews()) async throws -> InferenceFunction.Outputs

Parameters

  • inputs:

    A dictionary that maps input names to their Ndarray values.

  • states:

    The in-out arguments of the function, which the function reads and writes during inference. You must provide views for all states; omitting any state produces an error.

  • outputViews:

    Pre-allocated output values that the function updates during inference. Outputs with a provided view are updated in-place and are not included in the returned Outputs. Outputs without a provided view produce new values in the returned Outputs.

Return Value

The outputs from the function.

Discussion

This is a convenience overload that accepts a dictionary of NDArray values instead of an InferenceFunction.Inputs collection.

Any NDArray values in the returned outputs have a row-major contiguous layout.