如何将张量转换为nummul数组的结果matmul

问题描述 投票:-1回答:1

我想将fc1张量转换为numpy数组。如何获得?

fc1 = tf.reshape(conv1, [-1, weights['wd1'].get_shape().as_list()[0]])
fc1 = tf.matmul(fc1, weights['wd1'])
python
1个回答
0
投票

Session.run或eval返回的任何张量都是NumPy数组。因此,张量到numpy数组,您只需在转换后的张量上运行.eval()即可。

即:

 sess = tf.Session()
 fc1.eval(session=sess)
© www.soinside.com 2019 - 2024. All rights reserved.