Contents

bnns_graph_realloc_fn_t

The workspace and output allocation function.

Declaration

typealias bnns_graph_realloc_fn_t = (UnsafeMutableRawPointer?, Int, UnsafeMutablePointer<UnsafeMutableRawPointer?>, Int, Int) -> Int32

Return Value

0 on success, nonzero on failure.

Discussion

BNNS may call this function for either an initial allocation, or to resize an existing allocation.

Typically, on the first execution of a graph all calls to this function are for allocation. Subsequent calls with the same context are for reallocation.

An optimized implementation should track sizes and avoid reallocating if the size is the same or smaller.

See Also

Specifying a context’s allocation callbacks