日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

tensorflow的一些函数

發布時間:2023/12/13 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tensorflow的一些函数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.tf.constant(value,dtype=None,shape=None,name='Const')

注意這個函數創造的是一個常數tensor,而不是一個具體的常數

value:即可以是list,也可以是value

dtype:對應生成的tensor里的元素的類型

# Constant 1-D Tensor populated with value list.tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) => [1 2 3 4 5 6 7]              注意這種直接加入list的情況# Constant 2-D tensor populated with scalar value -1.tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.][-1. -1. -1.]]

對于value給tensor,并不是不能shape形狀,如果shape出來value中的元素不夠用時,就以最后一個元素重復出現填充至滿足形狀。

以下實例:

>>> sess = tf.InteractiveSession()>>> a = tf.constant([1,2,3],shape = [6]) >>> b = tf.constant([1,2,3],shape = [3,2]) >>> c = tf.constant([1,2,3],shape = [2,3])>>> print sess.run(a) [1 2 3 3 3 3] >>> print sess.run(b) [[1 2][3 3][3 3]] >>> print sess.run(c) [[1 2 3][3 3 3]]

?

?2.tf.truncated_normal(shape,mean=0.0,stddev=1.0,dtype=tf.float32,seed=None,name=None)

這個函數是從截斷的正態分布產生隨機數

mean:均值

stddev:標準差

轉載于:https://www.cnblogs.com/ymjyqsx/p/6530016.html

總結

以上是生活随笔為你收集整理的tensorflow的一些函数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。