withMLTensorComputePolicy(_:_:)
Calls the given closure within a task-local context using the specified compute policy to influence what compute device tensor operations are executed on.
Declaration
func withMLTensorComputePolicy<R>(_ computePolicy: MLComputePolicy, _ body: () async throws -> R) async rethrows -> RParameters
- computePolicy:
A compute policy that will be set before the closure gets called and restored after the closure returns.
- body:
A nullary closure. If the closure has a return value, that value is also used as the return value of the
withMLTensorComputePolicy(_:_:)function.
Return Value
The return value, if any, of the body closure.