# Shape

public final class **Shape** The possibly partially known shape of a tensor produced by an operation.

### Public Methods

|---|---|
| boolean | [equals](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#equals(java.lang.Object))(Object obj) |
| int | [hashCode](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#hashCode())() |
| static [Shape](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape) | [make](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#make(long, long...))(long firstDimensionSize, long... otherDimensionSizes) Create a Shape representing an N-dimensional value. |
| int | [numDimensions](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#numDimensions())() Number of dimensions represented by this shape. |
| static [Shape](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape) | [scalar](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#scalar())() Create a Shape representing a scalar value. |
| long | [size](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#size(int))(int i) The size of the i-th dimension. |
| String | [toString](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#toString())() Succinct description of the shape meant for debugging. |
| static [Shape](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape) | [unknown](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape#unknown())() Create a Shape representing an unknown number of dimensions. |

### Inherited Methods

From class java.lang.Object

|---|---|
| boolean | equals(Object arg0) |
| final Class\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| String | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Methods

#### public boolean
**equals**
(Object obj)

<br />

##### Parameters

| obj |   |
|---|---|

#### public int
**hashCode**
()

<br />

#### public static [Shape](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape)
**make**
(long firstDimensionSize, long... otherDimensionSizes)

Create a Shape representing an N-dimensional value.

Creates a Shape representing an N-dimensional value (N being at least 1), with the provided
size for each dimension. A -1 indicates that the size of the corresponding dimension is
unknown. For example:

    // A 2-element vector.
     Shape vector = Shape.create(2);

     // A 2x3 matrix.
     Shape matrix = Shape.create(2, 3);

     // A matrix with 4 columns but an unknown number of rows.
     // This is typically used to indicate the shape of tensors that represent
     // a variable-sized batch of values. The Shape below might represent a
     // variable-sized batch of 4-element vectors.
     Shape batch = Shape.create(-1, 4);
     
<br />

##### Parameters

| firstDimensionSize |   |
| otherDimensionSizes |   |
|---|---|

#### public int
**numDimensions**
()

Number of dimensions represented by this shape.

##### Returns

- -1 if the number of dimensions is unknown, 0 if the shape represents a scalar, 1 for a vector, 2 for a matrix etc.

#### public static [Shape](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape)
**scalar**
()

Create a Shape representing a scalar value.

#### public long
**size**
(int i)

The size of the i-th dimension.

##### Parameters

| i |   |
|---|---|

##### Returns

- The size of the requested dimension or -1 if it is unknown.

#### public String
**toString**
()

Succinct description of the shape meant for debugging.

#### public static [Shape](https://www.tensorflow.org/api_docs/java/reference/org/tensorflow/Shape)
**unknown**
()

Create a Shape representing an unknown number of dimensions.