首页 > 其他 > 详细

tf.shape函数

时间:2020-05-11 22:14:30      阅读:67      评论:0      收藏:0      [点我收藏+]

tf.shape

1 tf.shape(
2     input,
3     name=None,
4     out_type=tf.int32
5 )

例如:

  • 将矩阵的维度输出为一个维度矩阵
 1 import tensorflow as tf
 2 import numpy as np
 3 
 4 A = np.array([[[1, 1, 1],
 5                [2, 2, 2]],
 6               [[3, 3, 3],
 7                [4, 4, 4]],
 8               [[5, 5, 5],
 9                [6, 6, 6]]])
10 
11 t = tf.shape(A)
12 with tf.Session() as sess:
13     print(sess.run(t))
14 
15 # 输出
16 [3 2 3]

参数

  • input:张量或稀疏张量
  • name:op 的名字,用于tensorboard中
  • out_type:默认为tf.int32

返回值

  • 返回out_type类型的张量

转载https://blog.csdn.net/apengpengpeng/article/details/80579658

tf.shape函数

原文:https://www.cnblogs.com/Carits/p/12872503.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!