Contents

BNNSGraphContextSetBatchSize(_:_:_:)

Sets the batch size for a graph.

Declaration

func BNNSGraphContextSetBatchSize(_ context: bnns_graph_context_t, _ function: UnsafePointer<CChar>?, _ batch_size: UInt64) -> Int32

Parameters

  • context:

    The graph context.

  • function:

    The function. Specify as nil if the graph only contains one function.

  • batch_size:

    The batch size.

Return Value

0 on success, nonzero on failure.

Discussion

This function provides a special case of BNNSGraphContextSetDynamicShapes(_:_:_:_:) where the only dynamic size is the first index of the tensors and that size is equal for all tensors. This function provides a simpler API because you only need to pass the common first dimension as the batch_size parameter.

If your graph contains other dynamic strides, use BNNSGraphContextSetDynamicShapes(_:_:_:_:) instead. This function doesn’t set dynamic strides.

Don’t call this function while existing calls to BNNSGraphContextExecute(_:_:_:_:_:_:) are running.

See Also

Specifying and querying a context’s properties