<p dir="auto">Not sure why the random state changed for non random operation like tf.constant</p>
<p dir="auto"><code class="notranslate">pip freeze|grep "python\|tensorflow"</code><br>
python-dateutil==2.7.2<br>
tensorflow==1.5.0<br>
tensorflow-tensorboard==1.5.1</p>
<p dir="auto">cat test.py</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import tensorflow as tf
print(tf.__version__)
seed = 0
def test1():
    graph = tf.Graph()
    with graph.as_default():
        tf.set_random_seed(seed)
        aaa = tf.random_uniform([1])
    sess = tf.Session(graph = graph)
    print(sess.run(aaa))
    print(sess.run(aaa))

def test2():
    graph = tf.Graph()
    with graph.as_default():
        tf.set_random_seed(seed)
        bbb = tf.constant([1,2])
        aaa = tf.random_uniform([1])
    sess = tf.Session(graph = graph)
    print(sess.run(aaa))
    print(sess.run(aaa))
if __name__ == &quot;__main__&quot;:
    test1()
    test1()
    test2()"><pre class="notranslate"><code class="notranslate">import tensorflow as tf
print(tf.__version__)
seed = 0
def test1():
    graph = tf.Graph()
    with graph.as_default():
        tf.set_random_seed(seed)
        aaa = tf.random_uniform([1])
    sess = tf.Session(graph = graph)
    print(sess.run(aaa))
    print(sess.run(aaa))

def test2():
    graph = tf.Graph()
    with graph.as_default():
        tf.set_random_seed(seed)
        bbb = tf.constant([1,2])
        aaa = tf.random_uniform([1])
    sess = tf.Session(graph = graph)
    print(sess.run(aaa))
    print(sess.run(aaa))
if __name__ == "__main__":
    test1()
    test1()
    test2()
</code></pre></div>
<p dir="auto">python test.py<br>
/home/tom/pyenv/anti/local/lib/python2.7/site-packages/h5py/<strong>init</strong>.py:36: FutureWarning: Conversion of the second argument of issubdtype from <code class="notranslate">float</code> to <code class="notranslate">np.floating</code> is deprecated. In future, it will be treated as <code class="notranslate">np.float64 == np.dtype(float).type</code>.<br>
from ._conv import register_converters as _register_converters<br>
1.5.0<br>
2018-06-14 16:06:47.429664: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA<br>
[0.3206401]<br>
[0.012326]<br>
[0.3206401]<br>
[0.012326]<br>
[0.2773143]<br>
[0.92967796]</p>
<h3 dir="auto">Environment info</h3>
<p dir="auto">Operating System:<br>
Windows 10, 64 bit</p>
<p dir="auto">Installed version of CUDA and cuDNN:<br>
CUDA 8.0<br>
cuDNN 5.1</p>
<p dir="auto">Intalled TF by the following:<br>
pip3 install --upgrade tensorflow-gpu</p>
<h3 dir="auto">If possible, provide a minimal reproducible example (We usually don't have time to read hundreds of lines of your code)</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import tensorflow as tf
from tensorflow.contrib import rnn
seq_max_len = 6
num_hidden = 5
sample_size = 4

#print(seq_len_arr)
x = tf.placeholder(tf.float32, [None, seq_max_len, sample_size], name='x')

seq_len = tf.placeholder(tf.int32, [None])

lstm_cell = rnn.LSTMBlockCell(num_hidden)
lstmLayers = rnn.MultiRNNCell([lstm_cell]*1)
outputs, states = tf.nn.dynamic_rnn(lstmLayers, x, sequence_length=seq_len, dtype=np.float32)
init_op = tf.global_variables_initializer()"><pre class="notranslate"><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">from</span> <span class="pl-s1">tensorflow</span>.<span class="pl-s1">contrib</span> <span class="pl-k">import</span> <span class="pl-s1">rnn</span>
<span class="pl-s1">seq_max_len</span> <span class="pl-c1">=</span> <span class="pl-c1">6</span>
<span class="pl-s1">num_hidden</span> <span class="pl-c1">=</span> <span class="pl-c1">5</span>
<span class="pl-s1">sample_size</span> <span class="pl-c1">=</span> <span class="pl-c1">4</span>

<span class="pl-c">#print(seq_len_arr)</span>
<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-en">placeholder</span>(<span class="pl-s1">tf</span>.<span class="pl-s1">float32</span>, [<span class="pl-c1">None</span>, <span class="pl-s1">seq_max_len</span>, <span class="pl-s1">sample_size</span>], <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">'x'</span>)

<span class="pl-s1">seq_len</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-en">placeholder</span>(<span class="pl-s1">tf</span>.<span class="pl-s1">int32</span>, [<span class="pl-c1">None</span>])

<span class="pl-s1">lstm_cell</span> <span class="pl-c1">=</span> <span class="pl-s1">rnn</span>.<span class="pl-v">LSTMBlockCell</span>(<span class="pl-s1">num_hidden</span>)
<span class="pl-s1">lstmLayers</span> <span class="pl-c1">=</span> <span class="pl-s1">rnn</span>.<span class="pl-v">MultiRNNCell</span>([<span class="pl-s1">lstm_cell</span>]<span class="pl-c1">*</span><span class="pl-c1">1</span>)
<span class="pl-s1">outputs</span>, <span class="pl-s1">states</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-s1">nn</span>.<span class="pl-en">dynamic_rnn</span>(<span class="pl-s1">lstmLayers</span>, <span class="pl-s1">x</span>, <span class="pl-s1">sequence_length</span><span class="pl-c1">=</span><span class="pl-s1">seq_len</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-s1">float32</span>)
<span class="pl-s1">init_op</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-en">global_variables_initializer</span>()</pre></div>
<h3 dir="auto">Logs or other output that would be helpful</h3>
<p dir="auto">(If logs are large, please upload as attachment or provide link).</p>
<p dir="auto">I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:135] successfully opened CUDA library cublas64_80.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:135] successfully opened CUDA library cudnn64_5.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:135] successfully opened CUDA library cufft64_80.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:135] successfully opened CUDA library nvcuda.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:135] successfully opened CUDA library curand64_80.dll locally<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_type: "CPU"') for unknown op: CountExtremelyRandomStats<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"') for unknown op: FinishedNodes<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for unknown op: GrowTree<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ReinterpretStringToFloat" device_type: "CPU"') for unknown op: ReinterpretStringToFloat<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "SampleInputs" device_type: "CPU"') for unknown op: SampleInputs<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ScatterAddNdim" device_type: "CPU"') for unknown op: ScatterAddNdim<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNInsert" device_type: "CPU"') for unknown op: TopNInsert<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNRemove" device_type: "CPU"') for unknown op: TopNRemove<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TreePredictions" device_type: "CPU"') for unknown op: TreePredictions<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "UpdateFertileSlots" device_type: "CPU"') for unknown op: UpdateFertileSlots<br>
Traceback (most recent call last):<br>
File "debug_lstm_zeros2.py", line 33, in <br>
outputs, states = tf.nn.dynamic_rnn(lstmLayers, x, sequence_length=seq_len, dtype=np.float32)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\rnn.py", line 545, in dynamic_rnn<br>
dtype=dtype)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\rnn.py", line 712, in _dynamic_rnn_loop<br>
swap_memory=swap_memory)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2626, in while_loop<br>
result = context.BuildLoop(cond, body, loop_vars, shape_invariants)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2459, in BuildLoop<br>
pred, body, original_loop_vars, loop_vars, shape_invariants)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2409, in _BuildLoop<br>
body_result = body(*packed_vars_for_body)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\rnn.py", line 695, in _time_step<br>
skip_conditionals=True)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\rnn.py", line 177, in _rnn_step<br>
new_output, new_state = call_cell()<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\rnn.py", line 683, in <br>
call_cell = lambda: cell(input_t, state)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\python\ops\core_rnn_cell_impl.py", line 655, in <strong>call</strong><br>
cur_inp, new_state = cell(cur_inp, cur_state)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\python\ops\lstm_ops.py", line 402, in <strong>call</strong><br>
use_peephole=self._use_peephole)<br>
File "C:\Users\jun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\contrib\rnn\python\ops\lstm_ops.py", line 122, in _lstm_block_cell<br>
return _lstm_ops_so.lstm_block_cell(<br>
AttributeError: 'NoneType' object has no attribute 'lstm_block_cell'</p>
<p dir="auto">Thanks a lot for your assistance!</p>
<p dir="auto">Jun</p>