---
title: "allocate(initializingFrom:shape:stride:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/bnnstensor/allocate(initializingfrom:shape:stride:)"
---

# allocate(initializingFrom:shape:stride:)

Creates a BNNSTensor populated with a copy of the values in source.

## Declaration

```swift
static func allocate<C>(initializingFrom source: C, shape: [Int], stride: [Int]) -> BNNSTensor where C : AccelerateBuffer, C.Element : BNNSScalar
```

## Parameters

- `source`: The collection that provides the source elements.
- `shape`: The shape of the tensor.
- `stride`: The stride of the tensor.
