BNNSGraphContextGetWorkspaceSize(_:_:)
Returns the minimum size, in bytes, of the workspace that graph context execution requires.
Declaration
func BNNSGraphContextGetWorkspaceSize(_ context: bnns_graph_context_t, _ function: UnsafePointer<CChar>?) -> IntParameters
- context:
The graph context.
- function:
The function. Specify as
nilif the graph only contains one function.
Return Value
The minimum size, in bytes, for the workspace, or SIZE_T_MAX if the query fails.
Discussion
Call this function to obtain the minimum size of the workspace that the BNNSGraphContextExecute function requires. If you call either BNNSGraphContextSetBatchSize(_:_:_:) or BNNSGraphContextSetDynamicShapes(_:_:_:_:), call this function afterwards to obtain the new workspace size.
Note that the workspace size may not be proportional with the dynamic size. That is, smaller input and output tensors may require a larger workspace.