title: TypeError: The added layer must be an instance of class Layer. Found: Tensor("input_1:0", shape=(None, 64, 64, 3), dtype=float32) -Python
body: <p>I actually try to make a convolutional neural network in order to classify dogs and cat ( i'm newbie in Machine Learning so don't judge me too bad :)  ). I got the exactly the same error from the title of this post. To be honest, i tried to learn myself from Keras API documentation, tried to catch some tips from stackoverflow,github,towardsdatascience and others. Some said that error belongs to different versions of tensorflow and keras libraries,others said that it belongs to syntax. I will leave my code here,tell me where i made mistakes,i'm open to learn new tips.</p>
  <pre><code>#IMPORTING LIBRARIES
  import tensorflow as tf
  import pandas as pd
  import keras
  from keras.preprocessing.image import ImageDataGenerator
  
  
  
  #IMAGE DATA PREPROCESSING
  
  #preprocessing the training set
  train_datagen = ImageDataGenerator(
          rescale=1./255,
          shear_range=0.2,
          zoom_range=0.2,
          horizontal_flip=True)
  training_set = train_datagen.flow_from_directory(
          directory = r&quot;C:\Users\Cucu\Downloads\training_set&quot;,
          target_size=(64 , 64),
          batch_size=32,
          class_mode='binary')
  
  #preprocessing the test set
  test_datagen = ImageDataGenerator(rescale=1./255)
  test_set = test_datagen.flow_from_directory(
          directory = r&quot;C:\Users\Cucu\Downloads\test_set&quot;,
          target_size=(64 , 64),
          batch_size=32,
          class_mode='binary')
  
  
   
  #BULDING THE CNN
  #
  #
  #initialising the cnn
  cnn = tf.keras.models.Sequential()
  
  
  #convolution
  cnn.add(tf.keras.layers.Conv2D(filters = 32 , kernel_size = 3 , activation = 'relu' ))
  cnn.add(keras.Input(shape=(64, 64, 3)))
  
  #pooling
  cnn.add(tf.keras.layers.MaxPool2D( pool_size = 2 , strides = 2))
  
  
  #adding a SECOND CONVOLUTIONAL LAYER
  cnn.add(tf.keras.layers.Conv2D(filters = 32 , kernel_size = 3 , activation = 'relu'))
  cnn.add(tf.keras.layers.MaxPool2D( pool_size = 2 , strides = 2))
  
  
  #flattening
  cnn.add(tf.keras.layers.Flatten())
  
  
  #full connection
  cnn.add(tf.keras.layers.Dense(units = 128 , activation = 'relu'))
  
  
  #adding the output layer
  cnn.add(tf.keras.layers.Dense(units = 4 , activation = 'sigmoid'))
  </code></pre>
  <p>and the error(exactly as the title) is:</p>
  <pre><code>TypeError: The added layer must be an instance of class Layer. Found: Tensor(&quot;input_1:0&quot;, shape=(None, 64, 64, 3), dtype=float32)
  </code></pre>
  <p>Massive apreciation to those who can give me some tips. I know this is an extra full beginner level,but you know,sometimes you have to learn along the way of practical experience:)</p>