title: Geting an error in Pycharm using TensorFlow "WARNING:tensorflow:Output dense_1 missing from loss dictionary"
body: <p>I am using PyCharm, and I am just getting into Neural Networks.</p>
  
  <p>I am trying to use TensorFlow 2.0,enter code here my system is 64bit.</p>
  
  <p>I am folowing this tutorial (<a href="https://www.tensorflow.org/tutorials/keras/classification" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/keras/classification</a>) on the TensorFlow website.</p>
  
  <p>And when I run the program, I get this error:</p>
  
  <p>*</p>
  
  <pre><code>WARNING:tensorflow:Output dense_1 missing from loss dictionary. We assume this was done on purpose. The fit and evaluate APIs will not be expecting any data to be passed to dense_1.
  Traceback (most recent call last):
    File "E:/PycharmProjects/NN_TensorFlow/NN_TensorFlow.py", line 52, in &lt;module&gt;
      metrics=['accuracy'])
    File "E:\PycharmProjects\NN_TensorFlow\venv\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 457, in _method_wrapper
      result = method(self, *args, **kwargs)
    File "E:\PycharmProjects\NN_TensorFlow\venv\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 373, in compile
      self._compile_weights_loss_and_weighted_metrics()
    File "E:\PycharmProjects\NN_TensorFlow\venv\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 457, in _method_wrapper
      result = method(self, *args, **kwargs)
    File "E:\PycharmProjects\NN_TensorFlow\venv\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 1653, in _compile_weights_loss_and_weighted_metrics
      self.total_loss = self._prepare_total_loss(masks)
    File "E:\PycharmProjects\NN_TensorFlow\venv\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 1752, in _prepare_total_loss
      raise ValueError('The model cannot be compiled '
  ValueError: The model cannot be compiled because it has no loss to optimize.
  </code></pre>
  
  <p>*</p>
  
  <p>Does anyone have any idea what is wrong?</p>
  
  <p>My code:</p>
  
  <pre><code>from __future__ import absolute_import, division, print_function, unicode_literals
  
  # TensorFlow and tf.keras
  import tensorflow as tf
  from tensorflow import keras
  
  # Helper libraries
  import numpy as np
  import matplotlib.pyplot as plt
  
  print(tf.__version__)
  
  # Load data set that exists in keras. There are a lot of data sets in keras
  data = keras.datasets.fashion_mnist
  
  # split into testing and training data
  (train_images, train_labels), (test_images, test_labels) = data.load_data()
  
  # asign a string to the number of the "lables".
  class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat',
                 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']
  
  # shrink the data. default color range is 0 - 255, we shrink it down to 0 - 1
  train_images = train_images/255.0
  test_images = test_images/255.0
  
  # show training image, cmap=plt.cm.binary -&gt; show image properly
  #plt.imshow(train_images[7], cmap=plt.cm.binary)
  #plt.show()
  
  # Neural network model, Define architecture of the model, SEQUENTIAL means you define the layers in order
  model = keras.Sequential([
      # INPUT LAYER FLATTEN
      # meaning the data is compressed in to an array of 784
      # instead of 28x28 matrix (matrix because its a 28 pixel x 28pixel image)
      keras.layers.Flatten(input_shape=(28,28)),
      # HIDDEN LAYER DENSE
      # meaning that every neuron is connected to every other neuron
      # Activation function = rectify linear unit (very fast function),
      # Activation function is arbitrary, meaning we can pick different ones
      keras.layers.Dense(128, activation="relu"),
      # OUTPUT LAYER DENSE
      # activation function = softmax (turning output values into 0 - 1)
      keras.layers.Dense(10, activation="softmax")
  ])
  
  # COMPILE OPTIMIZER "adam" (standard optimizer for such stuff)
  # LOSS FUNCTION "sparse_categorical_crossentropy" (very fameus function - look up ONLINE), Arbitrary
  # METRICS "accuracy" (what we are looking at, what do we want to do), we want to lower Loss function
  model.compile(optimizer='adam',
                Loss='sparse_categorical_crossentropy',
                metrics=['accuracy'])
  
  
  model.fit(train_images, train_labels, epochs=5)  # EPOCHS, how many times the computer seas the same image
  # having a higher EPOCHS doesn't necessary mean a higher accuracy
  
  test_loss, test_acc = model.evaluate(test_images,  test_labels, verbose=2)
  
  print("Tested Acc: ", test_acc)
  </code></pre>