---
title: rank
framework: coreml
role: symbol
role_heading: Instance Property
path: coreml/mltensor/rank
---

# rank

The number of dimensions of the tensor.

## Declaration

```swift
var rank: Int { get }
```

## Discussion

Discussion Rank is equal to the number of dimensions of the shape, i.e., tensor.rank == tensor.shape.count.

## See Also

### Accessing tensor properties

- [isScalar](coreml/mltensor/isscalar.md)
- [scalarCount](coreml/mltensor/scalarcount.md)
- [scalarType](coreml/mltensor/scalartype.md)
- [shape](coreml/mltensor/shape.md)
