tf.shape()
生活随笔
收集整理的這篇文章主要介紹了
tf.shape()
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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()的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tf.cast()数据类型转换
- 下一篇: tf.variable_scope 参数