Instance Method

evaluate(inputs:outputs:)

Evaluates the custom layer with the given inputs.

Required.

Declaration

func evaluate(inputs: [MLMultiArray], outputs: [MLMultiArray]) throws

Parameters

inputs

The array of inputs to be evaluated.

outputs

The array of outputs to be populated by evaluating the given inputs.

Discussion

Implement this method to evaluate the inputs using your layer's custom behavior and to populate the output arrays. It will be called for each evaluation of your model performed on the CPU.

The memory for both input and output arrays is preallocated; don't copy or move it. The inputs and outputs will have the shapes of the most recent call to outputShapes(forInputShapes:). Don't modify the input values.

Investigate vecLib for methods that could optimize your implementation significantly.

See Also

Evaluating a Layer

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software