---
title: "allocate(initializingFrom:shape:batchSize:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/bnnsndarraydescriptor/allocate(initializingfrom:shape:batchsize:)"
---

# allocate(initializingFrom:shape:batchSize:)

Returns a new n-dimensional array descriptor that’s initialized with a copy of the elements in the specified collection.

## Declaration

```swift
static func allocate<C>(initializingFrom source: C, shape: BNNS.Shape, batchSize: Int = 1) -> BNNSNDArrayDescriptor where C : Collection, C.Element : BNNSScalar
```

## Parameters

- `source`: The collection that provides the source elements.
- `shape`: The shape of n-dimensional array descriptor.
- `batchSize`: The number of batches of data.

## See Also

### Allocating and Deallocating Memory

- [allocate(randomUniformUsing:range:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocate(randomuniformusing:range:shape:batchsize:)-2rorb.md)
- [allocate(randomUniformUsing:range:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocate(randomuniformusing:range:shape:batchsize:)-761hg.md)
- [allocate(randomIn:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocate(randomin:shape:batchsize:)-1697a.md)
- [allocate(randomIn:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocate(randomin:shape:batchsize:)-5a2p2.md)
- [allocate(randomIn:using:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocate(randomin:using:shape:batchsize:)-5kbi8.md)
- [allocate(randomIn:using:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocate(randomin:using:shape:batchsize:)-3w6ig.md)
- [allocate(repeating:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocate(repeating:shape:batchsize:).md)
- [allocateUninitialized(scalarType:shape:batchSize:)](accelerate/bnnsndarraydescriptor/allocateuninitialized(scalartype:shape:batchsize:).md)
- [deallocate()](accelerate/bnnsndarraydescriptor/deallocate().md)
