<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraph",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO"
  },
  "title" : "BNNSGraph"
}
-->

# BNNSGraph

An enumeration that acts as a namespace for the Swift overlays to BNNS Graph.

```
enum BNNSGraph
```

## Topics

### Compiling a graph object and creating a context

[`class Context`](/documentation/Accelerate/BNNSGraph/Context)

A wrapper around a compiled graph object that adds a required modifiable context to support dynamically sized models and set execute-time options.

### Protocols

[`protocol PointerArgument`](/documentation/Accelerate/BNNSGraph/PointerArgument)

A type that BNNS Graph accepts as an input-output argument.

[`protocol TensorDescriptor`](/documentation/Accelerate/BNNSGraph/TensorDescriptor)

A protocol that allows `makeContext` to return a
collection of heterogeneously typed `Tensor` structures.

### Structures

[`struct Builder`](/documentation/Accelerate/BNNSGraph/Builder)

A structure thats provides a closure you can use to define the arguments and operations of a
BNNS Graph.

[`struct CompileOptions`](/documentation/Accelerate/BNNSGraph/CompileOptions)

The compilation options that BNNS uses when compiling a source mlmodelc file to a graph object.

[`struct Shape`](/documentation/Accelerate/BNNSGraph/Shape)

The specification of the shape of an argument.

### Type Methods

[`static func makeContext(options: BNNSGraph.CompileOptions, (inout BNNSGraph.Builder) -> [any BNNSGraph.TensorDescriptor]) throws -> BNNSGraph.Context`](/documentation/Accelerate/BNNSGraph/makeContext(options:_:))

Returns a new context that wraps a graph object that the given closure defines.

### Enumerations

[`enum Error`](/documentation/Accelerate/BNNSGraph/Error)

Error codes that a graph context throws.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)