Tensorflow: Cannot interpret feed_dict key as Tensor

前端 未结 7 1075
清歌不尽
清歌不尽 2020-12-08 14:27

I am trying to build a neural network model with one hidden layer (1024 nodes). The hidden layer is nothing but a relu unit. I am also processing the input data in batches o

7条回答
  •  无人及你
    2020-12-08 15:01

    Variable x is not in the same graph as model, try to define all of these in the same graph scope. For example,

    # define a graph
    graph1 = tf.Graph()
    with graph1.as_default():
        # placeholder
        x = tf.placeholder(...)
        y = tf.placeholder(...)
        # create model
        model = create(x, w, b)
    
    with tf.Session(graph=graph1) as sess:
    # initialize all the variables
    sess.run(init)
    # then feed_dict
    # ......
    

提交回复
热议问题