我想将fc1张量转换为numpy数组。如何获得?
fc1 = tf.reshape(conv1, [-1, weights['wd1'].get_shape().as_list()[0]])
fc1 = tf.matmul(fc1, weights['wd1'])
Session.run或eval返回的任何张量都是NumPy数组。因此,张量到numpy数组,您只需在转换后的张量上运行.eval()即可。
即:
sess = tf.Session()
fc1.eval(session=sess)