Watch keynotes, product sessions, workshops, and more from Google I/O

# TensorShapeProto

public final class TensorShapeProto

``` Dimensions of a tensor.
```
Protobuf type ``` tensorflow.TensorShapeProto ```

### Nested Classes

 class TensorShapeProto.Builder ` Dimensions of a tensor. ` class TensorShapeProto.Dim ` One dimension of the tensor. ` interface TensorShapeProto.DimOrBuilder

### Constants

 int DIM_FIELD_NUMBER int UNKNOWN_RANK_FIELD_NUMBER

### Public Methods

 boolean (Object obj) static TensorShapeProto TensorShapeProto final static com.google.protobuf.Descriptors.Descriptor TensorShapeProto.Dim (int index) ``` Dimensions of the tensor, such as {"input", 30}, {"output", 40} for a 30 x 40 2D tensor.``` int () ``` Dimensions of the tensor, such as {"input", 30}, {"output", 40} for a 30 x 40 2D tensor.``` List< TensorShapeProto.Dim > () ``` Dimensions of the tensor, such as {"input", 30}, {"output", 40} for a 30 x 40 2D tensor.``` TensorShapeProto.DimOrBuilder (int index) ``` Dimensions of the tensor, such as {"input", 30}, {"output", 40} for a 30 x 40 2D tensor.``` List () ``` Dimensions of the tensor, such as {"input", 30}, {"output", 40} for a 30 x 40 2D tensor.``` int final com.google.protobuf.UnknownFieldSet boolean () ` If true, the number of dimensions in the shape is unknown.` int () final boolean static TensorShapeProto.Builder ( TensorShapeProto prototype) static TensorShapeProto.Builder TensorShapeProto.Builder static TensorShapeProto (InputStream input) static TensorShapeProto (InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TensorShapeProto (ByteBuffer data) static TensorShapeProto (com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TensorShapeProto (ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TensorShapeProto (com.google.protobuf.CodedInputStream input) static TensorShapeProto (byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TensorShapeProto (com.google.protobuf.ByteString data) static TensorShapeProto (InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static TensorShapeProto (com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static () TensorShapeProto.Builder void (com.google.protobuf.CodedOutputStream output)

## Constants

#### public static final int DIM_FIELD_NUMBER

Constant Value: 2

#### public static final int UNKNOWN_RANK_FIELD_NUMBER

Constant Value: 3

## Public Methods

#### public TensorShapeProto.Dim getDim (int index)

``` Dimensions of the tensor, such as {"input", 30}, {"output", 40}
for a 30 x 40 2D tensor.  If an entry has size -1, this
corresponds to a dimension of unknown size. The names are
optional.
The order of entries in "dim" matters: It indicates the layout of the
values in the tensor in-memory representation.
The first entry in "dim" is the outermost dimension used to layout the
values, the last entry is the innermost dimension.  This matches the
in-memory layout of RowMajor Eigen tensors.
If "dim.size()" > 0, "unknown_rank" must be false.
```
``` repeated .tensorflow.TensorShapeProto.Dim dim = 2; ```

#### public int getDimCount ()

``` Dimensions of the tensor, such as {"input", 30}, {"output", 40}
for a 30 x 40 2D tensor.  If an entry has size -1, this
corresponds to a dimension of unknown size. The names are
optional.
The order of entries in "dim" matters: It indicates the layout of the
values in the tensor in-memory representation.
The first entry in "dim" is the outermost dimension used to layout the
values, the last entry is the innermost dimension.  This matches the
in-memory layout of RowMajor Eigen tensors.
If "dim.size()" > 0, "unknown_rank" must be false.
```
``` repeated .tensorflow.TensorShapeProto.Dim dim = 2; ```

#### public List< TensorShapeProto.Dim > getDimList ()

``` Dimensions of the tensor, such as {"input", 30}, {"output", 40}
for a 30 x 40 2D tensor.  If an entry has size -1, this
corresponds to a dimension of unknown size. The names are
optional.
The order of entries in "dim" matters: It indicates the layout of the
values in the tensor in-memory representation.
The first entry in "dim" is the outermost dimension used to layout the
values, the last entry is the innermost dimension.  This matches the
in-memory layout of RowMajor Eigen tensors.
If "dim.size()" > 0, "unknown_rank" must be false.
```
``` repeated .tensorflow.TensorShapeProto.Dim dim = 2; ```

#### public TensorShapeProto.DimOrBuilder getDimOrBuilder (int index)

``` Dimensions of the tensor, such as {"input", 30}, {"output", 40}
for a 30 x 40 2D tensor.  If an entry has size -1, this
corresponds to a dimension of unknown size. The names are
optional.
The order of entries in "dim" matters: It indicates the layout of the
values in the tensor in-memory representation.
The first entry in "dim" is the outermost dimension used to layout the
values, the last entry is the innermost dimension.  This matches the
in-memory layout of RowMajor Eigen tensors.
If "dim.size()" > 0, "unknown_rank" must be false.
```
``` repeated .tensorflow.TensorShapeProto.Dim dim = 2; ```

#### public List<? extends TensorShapeProto.DimOrBuilder > getDimOrBuilderList ()

``` Dimensions of the tensor, such as {"input", 30}, {"output", 40}
for a 30 x 40 2D tensor.  If an entry has size -1, this
corresponds to a dimension of unknown size. The names are
optional.
The order of entries in "dim" matters: It indicates the layout of the
values in the tensor in-memory representation.
The first entry in "dim" is the outermost dimension used to layout the
values, the last entry is the innermost dimension.  This matches the
in-memory layout of RowMajor Eigen tensors.
If "dim.size()" > 0, "unknown_rank" must be false.
```
``` repeated .tensorflow.TensorShapeProto.Dim dim = 2; ```

#### public boolean getUnknownRank ()

``` If true, the number of dimensions in the shape is unknown.
If true, "dim.size()" must be 0.
```
``` bool unknown_rank = 3; ```