# [Solved] Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,))

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,)) in python. So Here I am Explain to you all the possible solutions here.

## How Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,)) Error Occurs?

Today I get the following error Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,)) in python.

## How To Solve Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,)) Error ?

1. How To Solve Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,)) Error ?

To Solve Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,)) Error You eventually need to thin down the network to have the same outputs as your classes. For example, doing OCR for numbers needs and final output of Dense(10) (for numbers 0 to 9).

2. Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,))

To Solve Tensorflow estimator ValueError: logits and labels must have the same shape ((?, 1) vs (?,)) Error You eventually need to thin down the network to have the same outputs as your classes. For example, doing OCR for numbers needs and final output of Dense(10) (for numbers 0 to 9).

## Solution 1

You should reshape your labels as 2d-tensor (the first dimension will be the batch dimension and the second the scalar label):

```# Our vectorized labels
y_train = np.asarray(train_labels).astype('float32').reshape((-1,1))
y_test = np.asarray(test_labels).astype('float32').reshape((-1,1))```