<p dir="auto"><em>Please make sure that this is a bug. As per our <a href="https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md">GitHub Policy</a>, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>Have I written custom code (as opposed to using a stock example script provided in TensorFlow):</li>
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04):</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:</li>
<li>TensorFlow installed from (source or binary):</li>
<li>TensorFlow version (use command below):</li>
<li>Python version:</li>
<li>Bazel version (if compiling from source):</li>
<li>GCC/Compiler version (if compiling from source):</li>
<li>CUDA/cuDNN version:</li>
<li>GPU model and memory:</li>
</ul>
<p dir="auto">You can collect some of this information using our environment capture<br>
<a href="https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh">script</a><br>
You can also obtain the TensorFlow version with: 1. TF 1.0: <code class="notranslate">python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"</code> 2. TF 2.0: <code class="notranslate">python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"</code></p>
<p dir="auto"><strong>Describe the current behavior</strong></p>
<p dir="auto"><strong>Describe the expected behavior</strong></p>
<p dir="auto"><strong>Code to reproduce the issue</strong><br>
Provide a reproducible test case that is the bare minimum necessary to generate the problem.</p>
<p dir="auto"><strong>Other info / logs</strong><br>
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.</p>
<p dir="auto">I got an error message including a request that I report a bug.</p>
<p dir="auto">Here's the code:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import tensorflow as tf
import platform

print()
print(f&quot;PLATFORM:\n---------\n{platform.platform()}&quot;)
print(&quot;\nTENSORFLOW:\n----------&quot;)
for a in tf.version.__all__:
    print(f&quot;{a}: {getattr(tf.version, a)}&quot;)

print(f&quot;\nNUMPY:\n-----\n{np.version.version}&quot;)

print(f&quot;\nPYTHON:\n-------\n{sys.version}\n&quot;)

np.random.seed(0)
tf.random.set_seed(0)


model = tf.keras.models.Sequential([
    tf.keras.layers.Dense(1, activation=&quot;linear&quot;)
])
model.compile(optimizer=&quot;sgd&quot;, loss=&quot;mse&quot;)

x = np.random.uniform(size=(1,1))
y = np.random.uniform(size=(1,))
model.fit(x, y, epochs=1)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">tensorflow</span> <span class="pl-k">as</span> <span class="pl-s1">tf</span>
<span class="pl-k">import</span> <span class="pl-s1">platform</span>

<span class="pl-en">print</span>()
<span class="pl-en">print</span>(<span class="pl-s">f"PLATFORM:<span class="pl-cce">\n</span>---------<span class="pl-cce">\n</span><span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">platform</span>.<span class="pl-en">platform</span>()<span class="pl-kos">}</span></span>"</span>)
<span class="pl-en">print</span>(<span class="pl-s">"<span class="pl-cce">\n</span>TENSORFLOW:<span class="pl-cce">\n</span>----------"</span>)
<span class="pl-k">for</span> <span class="pl-s1">a</span> <span class="pl-c1">in</span> <span class="pl-s1">tf</span>.<span class="pl-s1">version</span>.<span class="pl-s1">__all__</span>:
    <span class="pl-en">print</span>(<span class="pl-s">f"<span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">a</span><span class="pl-kos">}</span></span>: <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-en">getattr</span>(<span class="pl-s1">tf</span>.<span class="pl-s1">version</span>, <span class="pl-s1">a</span>)<span class="pl-kos">}</span></span>"</span>)

<span class="pl-en">print</span>(<span class="pl-s">f"<span class="pl-cce">\n</span>NUMPY:<span class="pl-cce">\n</span>-----<span class="pl-cce">\n</span><span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">np</span>.<span class="pl-s1">version</span>.<span class="pl-s1">version</span><span class="pl-kos">}</span></span>"</span>)

<span class="pl-en">print</span>(<span class="pl-s">f"<span class="pl-cce">\n</span>PYTHON:<span class="pl-cce">\n</span>-------<span class="pl-cce">\n</span><span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">sys</span>.<span class="pl-s1">version</span><span class="pl-kos">}</span></span><span class="pl-cce">\n</span>"</span>)

<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">seed</span>(<span class="pl-c1">0</span>)
<span class="pl-s1">tf</span>.<span class="pl-s1">random</span>.<span class="pl-en">set_seed</span>(<span class="pl-c1">0</span>)


<span class="pl-s1">model</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-s1">keras</span>.<span class="pl-s1">models</span>.<span class="pl-v">Sequential</span>([
    <span class="pl-s1">tf</span>.<span class="pl-s1">keras</span>.<span class="pl-s1">layers</span>.<span class="pl-v">Dense</span>(<span class="pl-c1">1</span>, <span class="pl-s1">activation</span><span class="pl-c1">=</span><span class="pl-s">"linear"</span>)
])
<span class="pl-s1">model</span>.<span class="pl-en">compile</span>(<span class="pl-s1">optimizer</span><span class="pl-c1">=</span><span class="pl-s">"sgd"</span>, <span class="pl-s1">loss</span><span class="pl-c1">=</span><span class="pl-s">"mse"</span>)

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">uniform</span>(<span class="pl-s1">size</span><span class="pl-c1">=</span>(<span class="pl-c1">1</span>,<span class="pl-c1">1</span>))
<span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">uniform</span>(<span class="pl-s1">size</span><span class="pl-c1">=</span>(<span class="pl-c1">1</span>,))
<span class="pl-s1">model</span>.<span class="pl-en">fit</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">epochs</span><span class="pl-c1">=</span><span class="pl-c1">1</span>)</pre></div>
<p dir="auto">And here's the output, including system info, module versions, etc.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
PLATFORM:
---------
Darwin-18.7.0-x86_64-i386-64bit

TENSORFLOW:
----------
COMPILER_VERSION: 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)
GIT_VERSION: v2.0.0-beta1-5101-gc75bb66a99
GRAPH_DEF_VERSION: 119
GRAPH_DEF_VERSION_MIN_CONSUMER: 0
GRAPH_DEF_VERSION_MIN_PRODUCER: 0
VERSION: 2.0.0-rc0

NUMPY:
-----
1.17.1

PYTHON:
-------
3.7.4 (default, Jul  9 2019, 18:13:23) 
[Clang 10.0.1 (clang-1001.0.46.4)]

Train on 1 samples
WARNING:tensorflow:Entity &lt;function Function._initialize_uninitialized_variables.&lt;locals&gt;.initialize_variables at 0x1492748c0&gt; could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: module 'gast' has no attribute 'Num'
WARNING: Entity &lt;function Function._initialize_uninitialized_variables.&lt;locals&gt;.initialize_variables at 0x1492748c0&gt; could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: module 'gast' has no attribute 'Num'
1/1 [==============================] - 0s 157ms/sample - loss: 1.2336

&lt;tensorflow.python.keras.callbacks.History at 0x14927b5d0&gt;"><pre class="notranslate"><code class="notranslate">
PLATFORM:
---------
Darwin-18.7.0-x86_64-i386-64bit

TENSORFLOW:
----------
COMPILER_VERSION: 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)
GIT_VERSION: v2.0.0-beta1-5101-gc75bb66a99
GRAPH_DEF_VERSION: 119
GRAPH_DEF_VERSION_MIN_CONSUMER: 0
GRAPH_DEF_VERSION_MIN_PRODUCER: 0
VERSION: 2.0.0-rc0

NUMPY:
-----
1.17.1

PYTHON:
-------
3.7.4 (default, Jul  9 2019, 18:13:23) 
[Clang 10.0.1 (clang-1001.0.46.4)]

Train on 1 samples
WARNING:tensorflow:Entity &lt;function Function._initialize_uninitialized_variables.&lt;locals&gt;.initialize_variables at 0x1492748c0&gt; could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: module 'gast' has no attribute 'Num'
WARNING: Entity &lt;function Function._initialize_uninitialized_variables.&lt;locals&gt;.initialize_variables at 0x1492748c0&gt; could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: module 'gast' has no attribute 'Num'
1/1 [==============================] - 0s 157ms/sample - loss: 1.2336

&lt;tensorflow.python.keras.callbacks.History at 0x14927b5d0&gt;
</code></pre></div>