<!--
{
  "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/Context/tensor(forFunction:argument:fillKnownDynamicShapes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO7ContextC6tensor11forFunction8argument22fillKnownDynamicShapesSo10BNNSTensoraSgSSSg_SSSbtF"
  },
  "title" : "tensor(forFunction:argument:fillKnownDynamicShapes:)"
}
-->

# tensor(forFunction:argument:fillKnownDynamicShapes:)

Returns an unallocated tensor for a given function argument.

```
func tensor(forFunction function: String? = nil, argument: String, fillKnownDynamicShapes: Bool) -> BNNSTensor?
```

## Parameters

`function`

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

`argument`

The name of the input or output argument.

`fillKnownDynamicShapes`

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 preceding calls to [`setDynamicShapes(_:forFunction:)`](/documentation/Accelerate/BNNSGraph/Context/setDynamicShapes(_:forFunction:)) or `/Accelerate/BNNSGraph/Context/setBatchSize(_:forFunction:)`. If BNNS is unable to derive the shapes, the function sets the dimensions to `-1`.

## See Also

[`func BNNSGraphContextGetTensor(bnns_graph_context_t, UnsafePointer<CChar>?, UnsafePointer<CChar>, Bool, UnsafeMutablePointer<BNNSTensor>) -> Int32`](/documentation/Accelerate/BNNSGraphContextGetTensor(_:_:_:_:_:))

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



---

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)