# ValueError: Data cardinality is ambiguous (TensorFlow)

I'm a first grader in computer science, and I'm trying to make a 56x56 image from 4 mnist images and make a model that can distinguish numbers in the 56x56 image.

I wrote the 56x56 images part, but I don't know how to pre-process the targets (answers).

The error I get is:

``````ValueError: Data cardinality is ambiguous
``````

My code is:

``````import tensorflow as tf
import matplotlib.pyplot as plt

(x_train, x_target), (y_train, y_target) = mnist

x_train = x_train / 255.0
y_train = y_train / 255.0

x_train_1 = x_train[:30000]
x_train_2 = x_train[30000:]
y_train_1 = y_train[:5000]
y_train_2 = y_train[5000:]

x_1 = []
x_2 = []
y_1 = []
y_2 = []

for i in range(0, len(x_train_1), 2):
x_1.append(tf.concat([x_train_1[i], x_train_1[i + 1]], axis=1))
x_2.append(tf.concat([x_train_2[i], x_train_2[i + 1]], axis=1))

xtrain2d = tf.concat([tf.concat([x_1[i], x_2[i]], axis=0) for i in range(len(x_1))], axis=0)

xtrain2d = tf.reshape(xtrain2d, (15000, 56, 56))

for i in range(0, len(y_train_1), 2):
y_1.append(tf.concat([y_train_1[i], y_train_1[i + 1]], axis=1))
y_2.append(tf.concat([y_train_2[i], y_train_2[i + 1]], axis=1))

ytrain2d = tf.concat([tf.concat([y_1[i], y_2[i]], axis=0) for i in range(len(y_1))], axis=0)

ytrain2d = tf.reshape(ytrain2d, (2500, 56, 56))

model = tf.keras.models.Sequential()