pre_mse, pre_y = sess.run(mse, y_hat, feed_dict = {x:X_test, y:y_test})
今天写了一个多层感知器的程序,我是想在Session中把mse和y_hat两个值取出来,发现如下报错:
TypeError: run() got multiple values for argument 'feed_dict'
查看了一下run函数:
run(
fetches,
feed_dict=None,
options=None,
run_metadata=None
)
各个参数的含义:
各个参数的含义:
Args:
fetches: A single graph element, a list of graph elements, or a dictionary whose values are graph elements or lists of graph elements (described above).
feed_dict: A dictionary that maps graph elements to values (described above).
options: A [RunOptions] protocol buffer
run_metadata: A [RunMetadata] protocol buffer
它给出的解释说:
fetch是一个计算图元素,或者是由计算图节点构成的列表或字典。因此我这种取法不对,修改如下:
pre_mse, pre_y = sess.run([mse, y_hat], feed_dict = {x:X_test, y:y_test})