``public struct TensorShape : ExpressibleByArrayLiteral``

A struct representing the shape of a tensor.

`TensorShape` is a thin wrapper around an array of integers that represent shape dimensions. All tensor types use `TensorShape` to represent their shape.

• ``` dimensions ```

The dimensions of the shape.

#### Declaration

``public var dimensions: [Int]``
• ``` init(_:) ```

Initialize with an array of dimensions. The rank of the tensor is the length of the array.

#### Declaration

``public init(_ dimensions: [Int])``

#### Parameters

 ``` dimensions ``` The shape dimensions.
• ``` init(_:) ```

Initialize with a collection of dimensions. The rank of the tensor is the length of the collection.

#### Declaration

``public init<C>(_ dimensions: C) where C : Collection, C.Element == Int``

#### Parameters

 ``` dimensions ``` The shape dimensions.
• ``` init(arrayLiteral:) ```

Initialize with an array literal representing the shape dimensions. The rank of the tensor is the number of dimensions.

#### Declaration

``public init(arrayLiteral elements: Int...)``

#### Parameters

 ``` dimensions ``` The shape dimensions.
• ``` init(_:) ```

Initialize with variadic elements representing the shape dimensions. The rank of the tensor is the number of elements.

#### Declaration

``public init(_ elements: Int...)``

#### Parameters

 ``` dimensions ``` The shape dimensions.
• ``` init(repeating:count:) ```

#### Declaration

``public init(repeating repeatedValue: Int, count: Int)``
• ``` rank ```

The rank of the shape (i.e. the number of dimensions).

#### Declaration

``public var rank: Int { get }``
• ``` contiguousSize ```

The size of the shape as a contiguously stored array.

#### Declaration

``public var contiguousSize: Int { get }``
• ``` pythonObject ```

#### Declaration

``public var pythonObject: PythonObject { get }``
• ``` count ```

The rank of the shape (i.e. the number of dimensions).

#### Declaration

``var count: Int { get }``
• ``` indices ```

#### Declaration

``var indices: Range<Int> { get }``
• ``` startIndex ```

#### Declaration

``var startIndex: Int { get }``
• ``` endIndex ```

#### Declaration

``var endIndex: Int { get }``
• ``` subscript(_:) ```

Access the size of the i-th dimension.

#### Declaration

``subscript(index: Int) -> Int { get }``

#### Parameters

 ``` index ``` The index of a dimension.
• ``` subscript(_:) ```

Access the size of the i-th dimension.

#### Declaration

``subscript(bounds: Range<Int>) -> TensorShape { get set }``

#### Parameters

 ``` index ``` The index of a dimension.
• ``` ==(_:_:) ```

#### Declaration

``public static func == (lhs: TensorShape, rhs: TensorShape) -> Bool``
• ``` encode(to:) ```

#### Declaration

``public func encode(to encoder: Encoder) throws``
• ``` init(from:) ```

#### Declaration

``public init(from decoder: Decoder) throws``