
numpy
codeSniper、
这个作者很懒,什么都没留下…
展开
-
tensorflow中的reshape(tensor,[1,-1])和reshape(tensor,[-1,1])
tf.reshape(tensor,[-1,1])将张量变为一维列向量 tf.reshape(tensor,[1,-1])将张量变为一维行向量 import tensorflow as tf a = [[1,2],[3,4],[5,6]] tf.reshape(a,[-1,1]) Out[13]: <tf.Tensor 'Reshape_4:0' shape=(6, 1) ...原创 2019-11-23 17:26:36 · 1380 阅读 · 0 评论 -
numpy扩展维度以及np.concatenate
a = np.arange(12).reshape(3,4) a array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) 使用np.reshape()将a由二维扩展到三维. b = np.reshape(a,(3,4,1)) b array([[[ 0], [ 1], ...原创 2019-05-02 15:26:03 · 5357 阅读 · 1 评论