Python np.split()和tf.nn.softmax的输出
我用Tensorflow做词性标注。我通过以下方式获得softmax层的输出(它使用tf.nn.softmax):Python np.split()和tf.nn.softmax的输出,python,arrays,numpy,tensorflow,Python,Arrays,Numpy,Tensorflow,我用Tensorflow做词性标注。我通过以下方式获得softmax层的输出(它使用tf.nn.softmax): pos_tags_confidences = sess.run( self.pos_tags_softmax_op, feed_dict=self.feed_dict(batch, is_test=True) ) POS标签有一个形状(580,21),看起来如下: [[ 2.84045556e-04 1.08584835e-07
pos_tags_confidences = sess.run(
self.pos_tags_softmax_op,
feed_dict=self.feed_dict(batch, is_test=True)
)
POS标签有一个形状(580,21),看起来如下:
[[ 2.84045556e-04 1.08584835e-07 5.98690785e-05 ...,
7.19540509e-18
9.11230517e-18 1.95343427e-21]
[ 9.98795390e-01 4.86789819e-12 1.50688564e-07 ...,
8.64652642e-23
2.89635869e-14 1.35281987e-18]
[ 1.54589606e-03 1.40889606e
我想在前面的数组中使用np.split(),并将其拆分为[550,30]
问题是我得到了以下结果:
- 形状为(550,21)的数组
- 空数组
- 另一个具有形状的阵列(550,21)
- 形状为(550,21)的数组
- 形状为(30,21)的数组
pos_tags_confidences = pos_tags_confidences.squeeze()
assert pos_tags_confidences.shape==(580, 21)
split_arrays = np.split(pos_tags_confidences, [550], axis=0)