<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Windows 10 v1803 Pro 64bit English</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:N/A</li>
<li>TensorFlow installed from (source or binary):source</li>
<li>TensorFlow version:1.12</li>
<li>Python version:3.6</li>
<li>Installed using virtualenv? pip? conda?:pip</li>
<li>Bazel version (if compiling from source):0.15</li>
<li>GCC/Compiler version (if compiling from source):MSVC 2015 update 3</li>
<li>CUDA/cuDNN version:N/A</li>
<li>GPU model and memory:N/A</li>
</ul>
<p dir="auto"><strong>Describe the problem</strong></p>
<p dir="auto"><strong>Provide the exact sequence of commands / steps that you executed before running into the problem</strong></p>
<p dir="auto"><em><strong>Commands</strong></em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="bazel build -c opt --verbose_failures //tensorflow/cc:tutorials_example_trainer"><pre class="notranslate"><code class="notranslate">bazel build -c opt --verbose_failures //tensorflow/cc:tutorials_example_trainer
</code></pre></div>
<p dir="auto"><em><strong>Steps</strong></em><br>
Setup as described in <a href="https://www.tensorflow.org/install/source_windows" rel="nofollow">official document</a></p>
<p dir="auto">.bazelrc is customized in the following way.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import (YOUR_TENSORFLOW_FOLDER)/tf_configure.bazelrc"><pre class="notranslate"><code class="notranslate">import (YOUR_TENSORFLOW_FOLDER)/tf_configure.bazelrc
</code></pre></div>
<p dir="auto">.tf_configure.bazelrc is customized in the following way.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="build:ignite --define with_ignite_support=true
build:xla --define with_xla_support=false
build --action_env TF_NEED_OPENCL_SYCL=&quot;0&quot;
build --action_env TF_NEED_ROCM=&quot;0&quot;
build --action_env TF_NEED_CUDA=&quot;0&quot;
build --action_env TF_DOWNLOAD_CLANG=&quot;0&quot;
build:opt --copt=/arch:AVX2
build:opt --define with_default_optimizations=true
build --copt=-w --host_copt=-w
build --verbose_failures
build --distinct_host_configuration=false
build --experimental_shortened_obj_file_path=true
build --define=no_tensorflow_py_deps=true
build --define=override_eigen_strong_inline=true
build:v2 --define=tf_api_version=2"><pre class="notranslate"><code class="notranslate">build:ignite --define with_ignite_support=true
build:xla --define with_xla_support=false
build --action_env TF_NEED_OPENCL_SYCL="0"
build --action_env TF_NEED_ROCM="0"
build --action_env TF_NEED_CUDA="0"
build --action_env TF_DOWNLOAD_CLANG="0"
build:opt --copt=/arch:AVX2
build:opt --define with_default_optimizations=true
build --copt=-w --host_copt=-w
build --verbose_failures
build --distinct_host_configuration=false
build --experimental_shortened_obj_file_path=true
build --define=no_tensorflow_py_deps=true
build --define=override_eigen_strong_inline=true
build:v2 --define=tf_api_version=2
</code></pre></div>
<p dir="auto"><strong>Any other info / logs</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol &quot;__declspec(dllimport) public: virtual __cdecl icu_62::ErrorCode::~ErrorCode(void)&quot; (__imp_??1ErrorCode@icu_62@@UEAA@XZ) referenced in function &quot;public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)&quot; (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol &quot;__declspec(dllimport) public: signed char __cdecl icu_62::ErrorCode::isSuccess(void)const &quot; (__imp_?isSuccess@ErrorCode@icu_62@@QEBACXZ) referenced in function &quot;public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)&quot; (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol &quot;__declspec(dllimport) public: enum UErrorCode __cdecl icu_62::ErrorCode::reset(void)&quot; (__imp_?reset@ErrorCode@icu_62@@QEAA?AW4UErrorCode@@XZ) referenced in function &quot;public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)&quot; (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol &quot;__declspec(dllimport) const icu_62::ErrorCode::`vftable'&quot; (__imp_??_7ErrorCode@icu_62@@6B@) referenced in function &quot;public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)&quot; (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)"><pre class="notranslate"><code class="notranslate">unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl icu_62::ErrorCode::~ErrorCode(void)" (__imp_??1ErrorCode@icu_62@@UEAA@XZ) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: signed char __cdecl icu_62::ErrorCode::isSuccess(void)const " (__imp_?isSuccess@ErrorCode@icu_62@@QEBACXZ) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum UErrorCode __cdecl icu_62::ErrorCode::reset(void)" (__imp_?reset@ErrorCode@icu_62@@QEAA?AW4UErrorCode@@XZ) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) const icu_62::ErrorCode::`vftable'" (__imp_??_7ErrorCode@icu_62@@6B@) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
</code></pre></div>
<p dir="auto">Similar to tutorials_example_trainer, build //tensorflow/examples/label_image:label_image also failed.</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): Yes</li>
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10</li>
<li>TensorFlow installed from (source or binary): Binary (Anaconda)</li>
<li>TensorFlow version (use command below): 1.13.1</li>
<li>Python version: 3.7.3</li>
<li>CUDA/cuDNN version: 10.0/7.6.0</li>
<li>GPU model and memory: NVIDIA Titan X (Pascal), 12 GB</li>
</ul>
<p dir="auto"><strong>Describe the current behavior</strong></p>
<p dir="auto"><code class="notranslate">tf.einsum</code> returns buggy values compared to <code class="notranslate">np.einsum</code> for identical parameters. Here is the current output (please find code below):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="np: 8.610251426696777
tf: 0.0"><pre class="notranslate"><code class="notranslate">np: 8.610251426696777
tf: 0.0
</code></pre></div>
<p dir="auto">Please also note that the same code works as expected when running on the CPU. It also works correctly on the GPU in TF 1.12.0, CUDA/cuDNN 9.0/7.3.1 and Python 3.6.8.</p>
<p dir="auto"><strong>Describe the expected behavior</strong></p>
<p dir="auto">Here is the expected output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="np: 8.610251426696777
tf: 8.610251426696777"><pre class="notranslate"><code class="notranslate">np: 8.610251426696777
tf: 8.610251426696777
</code></pre></div>
<p dir="auto"><strong>Code to reproduce the issue</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from __future__ import (
    absolute_import,
    division,
    print_function
)

import tensorflow as tf
import numpy as np

tf.enable_eager_execution()

einsum_string = &quot;bijk,bijk-&gt;bij&quot;

# load values
S_h_numpy = np.load(&quot;./S_h.npy&quot;)
S_h = tf.convert_to_tensor(S_h_numpy, dtype=tf.float32)

h_numpy = np.load(&quot;./h.npy&quot;)
h = tf.convert_to_tensor(
    h_numpy,
    dtype=tf.float32
)

# perform einsum
ht_S_h_numpy = np.einsum(einsum_string, h_numpy, S_h_numpy)
ht_S_h = tf.einsum(einsum_string, h, S_h)

print(&quot;np: {np_val}\ntf: {tf_val}&quot;.format(
    np_val=ht_S_h_numpy[2, 191, 191],
    tf_val=ht_S_h[2, 191, 191],
))"><pre class="notranslate"><code class="notranslate">from __future__ import (
    absolute_import,
    division,
    print_function
)

import tensorflow as tf
import numpy as np

tf.enable_eager_execution()

einsum_string = "bijk,bijk-&gt;bij"

# load values
S_h_numpy = np.load("./S_h.npy")
S_h = tf.convert_to_tensor(S_h_numpy, dtype=tf.float32)

h_numpy = np.load("./h.npy")
h = tf.convert_to_tensor(
    h_numpy,
    dtype=tf.float32
)

# perform einsum
ht_S_h_numpy = np.einsum(einsum_string, h_numpy, S_h_numpy)
ht_S_h = tf.einsum(einsum_string, h, S_h)

print("np: {np_val}\ntf: {tf_val}".format(
    np_val=ht_S_h_numpy[2, 191, 191],
    tf_val=ht_S_h[2, 191, 191],
))
</code></pre></div>
<p dir="auto"><strong>Other info / logs</strong></p>
<p dir="auto">Here are the input tensors used in the example: <a href="https://github.com/tensorflow/tensorflow/files/3296468/input_tensors.zip">input_tensors.zip</a>.</p>
<p dir="auto">The tensors are of shape (4, 192, 192, 2). I could not choose a smaller example because the buggy values appear only in part of the second and all of the following batch items. The bug therefore seems to be connected to the size of the input.</p>