<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraphContextGetTensor(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@BNNSGraphContextGetTensor"
  },
  "title" : "BNNSGraphContextGetTensor(_:_:_:_:_:)"
}
-->

# BNNSGraphContextGetTensor(_:_:_:_:_:)

Sets the properties of a tensor for the specified function argument.

```
func BNNSGraphContextGetTensor(_ context: bnns_graph_context_t, _ function: UnsafePointer<CChar>?, _ argument: UnsafePointer<CChar>, _ fill_known_dynamic_shapes: Bool, _ tensor: UnsafeMutablePointer<BNNSTensor>) -> Int32
```

## Parameters

`context`

The graph context.

`function`

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

`argument`

The name of the input or output argument.

`fill_known_dynamic_shapes`

A Boolean value that specifies whether the function should replace any dynamic shapes for the next execution of the context. BNNS derives these shapes either from the default shapes in the source model, or from a preceding calls to [`BNNSGraphContextSetDynamicShapes(_:_:_:_:)`](/documentation/Accelerate/BNNSGraphContextSetDynamicShapes(_:_:_:_:)) or [`BNNSGraphContextSetBatchSize(_:_:_:)`](/documentation/Accelerate/BNNSGraphContextSetBatchSize(_:_:_:)). If BNNS is unable to derive the shapes, the function sets the dimensions to `-1`.

`tensor`

The tensor. On output, all fields apart from [`data`](/documentation/Accelerate/BNNSTensor/data) contain the properties for the specified function argument.

## Return Value

`0` on success, nonzero on failure.

## Discussion

---

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)