[Python] How do I correctly reshape image tensors for Conv2D in TensorFlow?

Discussão em 'Python' iniciado por Stack, Setembro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to build a simple CNN in TensorFlow/Keras, but I’m running into a shape error when passing my input images into the first Conv2D layer.

    I tried reshaping with X_train.reshape(-1, 28, 28, 1) but wasn’t sure if this is the correct approach.

    I also tried setting input_shape=(28,28) instead of (28,28,1) but then Conv2D gives another error.

    Continue reading...

Compartilhe esta Página