---
title: "init(shape:dataType:)"
framework: ML Compute
role: symbol
role_heading: Initializer
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: "mlcompute/mlctensor/init(shape:datatype:)"
---

# init(shape:dataType:)

Creates a tensor without data, with the shape and data type you specify.

## Declaration

```swift
convenience init(shape: [Int], dataType: MLCDataType)
```

## Parameters

- `shape`: An array that contains the sizes of each dimension.
- `dataType`: The tensor data type.

## Discussion

Discussion The tensor data type is MLCDataType.float32.

## See Also

### Creating Tensors by Specifying Shape

- [init(shape:)](mlcompute/mlctensor/init(shape:).md)
- [init(shape:data:dataType:)](mlcompute/mlctensor/init(shape:data:datatype:).md)
- [init(shape:fillWithData:dataType:)](mlcompute/mlctensor/init(shape:fillwithdata:datatype:).md)
- [init(shape:randomInitializerType:)](mlcompute/mlctensor/init(shape:randominitializertype:).md)
- [init(width:height:featureChannelCount:batchSize:)](mlcompute/mlctensor/init(width:height:featurechannelcount:batchsize:).md)
- [init(width:height:featureChannelCount:batchSize:data:)](mlcompute/mlctensor/init(width:height:featurechannelcount:batchsize:data:).md)
- [init(width:height:featureChannelCount:batchSize:data:dataType:)](mlcompute/mlctensor/init(width:height:featurechannelcount:batchsize:data:datatype:).md)
- [init(width:height:featureChannelCount:batchSize:fillWithData:dataType:)](mlcompute/mlctensor/init(width:height:featurechannelcount:batchsize:fillwithdata:datatype:).md)
- [init(width:height:featureChannelCount:batchSize:randomInitializerType:)](mlcompute/mlctensor/init(width:height:featurechannelcount:batchsize:randominitializertype:).md)
