永发信息网

python ,tensorflow 拒绝reshape问题

答案:2  悬赏:0  手机版
解决时间 2021-12-23 16:42
  • 提问者网友:容嬷嬷拿针来
  • 2021-12-22 18:03
afc1= tf.reshape(afc1,[1024,-1]),就是reshape 以后如何指导矩阵afc1的列是几个维度。就是-1 具体是多少,怎么取到,代码怎么写。
最佳答案
  • 五星知识达人网友:渡鹤影
  • 2022-01-10 03:55
import tensorflow as tf
from functools import reduce
from operator import mul
afc1= tf.reshape(afc1,[1024,-1])
print(reduce(mul,afc1.get_shape().as_list())/1024)
全部回答
  • 1楼网友:山有枢
  • 2022-01-10 05:20
>>> arr [[10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [12, 13, 14, 15, 16, 17, 18, 19, 20, 21], [13, 14, 15, 16, 17, 18, 19, 20, 21, 22], [14, 15, 16, 17, 18, 19, 20, 21, 22, 23], [15, 16, 17, 18, 19, 20, 21, 22, 23, 24], [16, 17, 18, 19, 20, 21, 22, 23, 24, 25], [17, 18, 19, 20, 21, 22, 23, 24, 25, 26], [18, 19, 20, 21, 22, 23, 24, 25, 26, 27], [19, 20, 21, 22, 23, 24, 25, 26, 27, 28], [20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]] >>> l = [x[0] for x in arr] >>> l [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] >>>
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯