在处理问题中,发现由于输入数据的类型不对,出现的问题,调试了很多次,终于成功了,问题包括:
TypeError: Fetch argument array([[0., 0., 0., ..., 0., 0., 0.]]) has invalid type <class 'numpy.ndarray'>, must be a string or Tensor. (Can not convert a ndarray into a Tensor or Operation.);
TypeError: The value of a feed cannot be a tf.Tensor object. Acceptable feed values include Python scalars, strings, lists, numpy ndarrays, or TensorHandles. For reference, the tensor object was Tensor("Cast_16:0", shape=(1, 98500), dtype=float32) which was passed to the feed with key Tensor("Placeholder_32:0", shape=(?, 98500), dtype=float32).
因为不管怎么改,总是会出现这个问题,这是由于输入的数据类型错误的原因,具体对应的输入的数据类型有:
可以feed的数据类型: Python scalars, strings, lists, numpy ndarrays, or TensorHandles.
可以fetch的数据类型:Tensor, string.
在运行图的时,tensor用sess.run()取出来,然后再feed进去。
其中,feed指的是 feed_dict里面字典的数据类型,fetch指的是 sess.run() 里面的数据类型