码迷,mamicode.com
首页 > 其他好文 > 详细

tf.shape()

时间:2019-07-14 14:46:46      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:输出   默认   ssi   sha   作者   zha   oar   article   声明   

tf.shape
tf.shape(
input,
name=None,
out_type=tf.int32
)
1
2
3
4
5
例如:
将矩阵的维度输出为一个维度矩阵
import tensorflow as tf
import numpy as np

A = np.array([[[1, 1, 1],
[2, 2, 2]],
[[3, 3, 3],
[4, 4, 4]],
[[5, 5, 5],
[6, 6, 6]]])

t = tf.shape(A)
with tf.Session() as sess:
print(sess.run(t))

# 输出
[3 2 3]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
参数
input:张量或稀疏张量
name:op 的名字,用于tensorboard中
out_type:默认为tf.int32
返回值
返回out_type类型的张量
---------------------
作者:Zhangppeng
来源:CSDN
原文:https://blog.csdn.net/apengpengpeng/article/details/80579658
版权声明:本文为博主原创文章,转载请附上博文链接!

tf.shape()

标签:输出   默认   ssi   sha   作者   zha   oar   article   声明   

原文地址:https://www.cnblogs.com/jfdwd/p/11184175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!