title: How can I fix "Unknown layer: DenseFeatures" while importing pre-trained keras model?
body: <p>I was following the tutorial for classifying structured data from <a href="https://www.tensorflow.org/alpha/tutorials/keras/feature_columns" rel="nofollow noreferrer">here</a>. I trained the model as described with my data which only comprised of numeric data. </p>
  
  <p>I have trained and optimised my model on google colab and downloaded it locally to test it on some new data.</p>
  
  <p>However, when I load the model using this snippet. </p>
  
  <pre><code>from keras.models import load_model
  model = load_model("my_model.h5")
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Unknown layer: DenseFeatures
  </code></pre>
  
  <p>...along with the trace.</p>
  
  <p>I have tried setting up <code>custom_objects</code> while loading the model like this</p>
  
  <pre><code>model = load_model("my_model.h5", custom_objects={'DenseFeatures': tf.keras.layers.DenseFeatures})
  </code></pre>
  
  <p>But I still get the following error:</p>
  
  <pre><code>__init__() takes at least 2 arguments (3 given)
  </code></pre>
  
  <p>What could I be doing wrong? I tried going through documentation but couldn't find anything of help on github.</p>