<!--
{
  "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/Shape",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO5ShapeV"
  },
  "title" : "BNNSGraph.Shape"
}
-->

# BNNSGraph.Shape

The specification of the shape of an argument.

```
struct Shape
```

## Overview

The [`setDynamicShapes(_:forFunction:)`](/documentation/Accelerate/BNNSGraph/Context/setDynamicShapes(_:forFunction:)) function uses arrays of [`BNNSGraph.Shape`](/documentation/Accelerate/BNNSGraph/Shape) structures as its input and output. This structure wraps the C API [`bnns_graph_shape_t`](/documentation/Accelerate/bnns_graph_shape_t) type and derives its rank from the number of elements in the [`dimensions`](/documentation/Accelerate/BNNSGraph/Shape/dimensions) array.

## Topics

### Creating a shape structure

[`init(arrayLiteral: Int...)`](/documentation/Accelerate/BNNSGraph/Shape/init(arrayLiteral:))

Creates a shape structure from the given array literal.

[`init([Int])`](/documentation/Accelerate/BNNSGraph/Shape/init(_:))

Creates a shape structure from the given array elements.

### Querying a shape structure’s properties

[`var dimensions: [Int]`](/documentation/Accelerate/BNNSGraph/Shape/dimensions)

An array that contains the dimensions of the shape structure.

### Type Aliases

[`typealias ArrayLiteralElement`](/documentation/Accelerate/BNNSGraph/Shape/ArrayLiteralElement)

The type of the elements of an array literal.

## Relationships

### Conforms To

[`ExpressibleByArrayLiteral`](/documentation/Swift/ExpressibleByArrayLiteral)

---

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)