0
グラフにテンソルオブジェクトをスライスして使用しようとしています。コードは以下の通りである:テンソルフローwhile_loop:ValueError:値がサポートされていません
self.batchSizeはtf.int32
の
placeholder
ある
utt_inputs = []
idx = tf.zeros(shape=(), dtype=tf.int32)
def add_inputs(idx):
utt_input = tf.slice(last_outputs, begin=[idx, 0], size=[self.args.uttWindowSize, self.args.wordUnits])
utt_inputs.append(utt_input)
def my_cond(idx):
idx = tf.add(idx, 1)
return tf.less(idx, self.batchSize)
tf.while_loop(cond=my_cond, body=add_inputs, loop_vars=[idx])
。 Last_outputsは2-dテンソルです。私は、コードを実行したときただし、tensorflowはエラーを与える:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pydev\pydevd.py", line 1596, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pydev\pydevd.py", line 974, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/v-zhaom/OneDrive/speakerRNN/main.py", line 5, in <module>
speakerTagger.main()
File "C:/Users/v-zhaom/OneDrive/speakerRNN\speakerChangeTagger\tagger.py", line 152, in main
self.model = RecurrentModel(self.args, self.textData)
File "C:/Users/v-zhaom/OneDrive/speakerRNN\speakerChangeTagger\RecurrentModel.py", line 29, in __init__
self.buildNetWork()
File "C:/Users/v-zhaom/OneDrive/speakerRNN\speakerChangeTagger\RecurrentModel.py", line 36, in buildNetWork
context_vectors = self._buildUttNetwork(last_outputs)
File "C:/Users/v-zhaom/OneDrive/speakerRNN\speakerChangeTagger\RecurrentModel.py", line 136, in _buildUttNetwork
tf.while_loop(cond=my_cond, body=add_inputs, loop_vars=[idx])
File "C:\Python35\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2636, in while_loop
result = context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "C:\Python35\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2469, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "C:\Python35\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2441, in _BuildLoop
next_vars.append(_AddNextAndBackEdge(m, v))
File "C:\Python35\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 635, in _AddNextAndBackEdge
v = ops.convert_to_tensor(v)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 669, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py", line 176, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py", line 165, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\Python35\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 360, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.