Tensorflow错误:“ TypeError:预期为int32,获取的列表包含类型为'_Message'的Tensors。”

时间:2019-04-05 12:49:28

标签: python tensorflow runtime-error concat

我正在使用使用Tensorflow的名为Spider3的软件,当我运行它时遇到以下问题:

Traceback (most recent call last):
  File "./scripts/spider3_impute.py", line 136, in <module>
    brnn_impute(args.directory_to_saved_networks, args.input_file_list, args.output_types, print_results=True, output_dir=args.directory_to_save_outputs, save_file_ext=args.save_ext, input_file_dir=args.input_dir, input_file_ext=args.input_ext)
  File "./scripts/spider3_impute.py", line 78, in brnn_impute
    y, ph_output_mask,ph_output_mask_encoded, n_classes, ph_keep_prob)
  File "./scripts/source/brnn_network_class.py", line 170, in __init__
    scope="RNN1"
  File "./scripts/source/brnn_network_class.py", line 83, in __init__
    dtype="float", scope=scope)
  File "./scripts/source/dynamic_brnn.py", line 91, in dynamic_bidirectional_rnn
    outputs = array_ops.concat(2, [output_fw, output_bw])
  File "/users/cn/sjin/.local/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1127, in concat
    dtype=dtypes.int32).get_shape().assert_is_compatible_with(
  File "/users/cn/sjin/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 932, in convert_to_tensor
    as_ref=False)
  File "/users/cn/sjin/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1022, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/users/cn/sjin/.local/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 233, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/users/cn/sjin/.local/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 212, in constant
    value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "/users/cn/sjin/.local/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 413, in make_tensor_proto
    _AssertCompatible(values, dtype)
  File "/users/cn/sjin/.local/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 328, in _AssertCompatible
    (dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

我已经看到其他人在tensorflow上有相同的“ TypeError: Expected int32, got list containing Tensors of type '_Message' instead”错误,但在其他程序上却有。他们中的一些人仅通过将“ concat([output_fw, output_bw], 2)”更改为“ concat(2, [output_fw, output_bw])”就解决了这一问题。但是,这不是我的情况,因为它的确写得很好。

知道这是什么原因吗?

顺便说一句,我正在使用Python 2.7.5和2.7.14,以及Tensorflow 1.5.0。

0 个答案:

没有答案