---
title: "BNNSGraphContextGetTensor(_:_:_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/bnnsgraphcontextgettensor(_:_:_:_:_:)"
---

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

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

## Declaration

```swift
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 doc://com.apple.accelerate/documentation/Accelerate/BNNSGraphContextSetDynamicShapes(_:_:_:_:) or doc://com.apple.accelerate/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 doc://com.apple.accelerate/documentation/Accelerate/BNNSTensor/data contain the properties for the specified function argument.

## Return Value

Return Value 0 on success, nonzero on failure.

## See Also

### Specifying and querying a tensor’s properties

- [BNNSTensor](accelerate/bnnstensor.md)
- [BNNSTensorGetAllocationSize(_:)](accelerate/bnnstensorgetallocationsize(_:).md)
- [BNNSGraphTensorFillStrides(_:_:_:_:)](accelerate/bnnsgraphtensorfillstrides(_:_:_:_:).md)
