dynamic_rnn()和array_ops.reverse_sequence()问题

时间:2016-04-07 15:17:20

标签: tensorflow

我尝试使用array_ops.reverse_sequence()转换我的输入,然后将其发送到dynamic_rnn(),推理图可以毫无问题地构建,但在构建训练图时,我收到以下错误:< / p>

Traceback (most recent call last):
  File "bin/trainer.py", line 158, in <module>
    kmer_len=args.kmer_len)
  File "/home/ubuntu/GIT/IvyMike/ivymike/base_model.py", line 193, in run_training
    train_op = model.training(loss, learning_rate)
  File "/home/ubuntu/GIT/IvyMike/ivymike/base_model.py", line 100, in training
    train_op = optimizer.minimize(loss, global_step=global_step)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/optimizer.py", line 190, in minimize
    colocate_gradients_with_ops=colocate_gradients_with_ops)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/optimizer.py", line 241, in compute_gradients
    colocate_gradients_with_ops=colocate_gradients_with_ops)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gradients.py", line 481, in gradients
    in_grads = _AsList(grad_fn(op, *out_grads))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_grad.py", line 307, in _ReverseSequenceGrad
    seq_lengths=seq_lengths),
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 1143, in reverse_sequence
    batch_dim=batch_dim, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/op_def_library.py", line 655, in apply_op
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2119, in create_op
    set_shapes_for_outputs(ret)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1586, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1257, in _ReverseSequenceShape
    (batch_dim, input_shape.ndims))
TypeError: %d format: a number is required, not NoneType

知道出了什么问题吗?

1 个答案:

答案 0 :(得分:0)

这已经在TensorFlow中修复了