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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

tensorflow1.11.0 tf.constant()函数(创建一个常数张量)

發布時間:2025/3/19 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tensorflow1.11.0 tf.constant()函数(创建一个常数张量) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

tf.constant

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

Defined in tensorflow/python/framework/constant_op.py.

See the guide: Constants, Sequences, and Random Values > Constant Value Tensors

Creates a constant tensor.
創建一個常數張量。

The resulting tensor is populated with values of type dtype, as specified by arguments value and (optionally) shape (see examples below).
生成的張量將填充dtype類型的值,該值由參數value和(可選)shape指定(請參見下面的示例)。

The argument value can be a constant value, or a list of values of type dtype. If value is a list, then the length of the list must be less than or equal to the number of elements implied by the shape argument (if specified). In the case where the list length is less than the number of elements specified by shape, the last element in the list will be used to fill the remaining entries.
參數值可以是常量值,也可以是dtype類型的值列表。
如果value是一個列表,則列表的長度必須小于或等于shape參數所隱含的元素數(如果指定)。
如果列表長度小于shape指定的元素數,則列表中的最后一個元素將用于填充其余條目。

The argument shape is optional. If present, it specifies the dimensions of the resulting tensor. If not present, the shape of value is used.
參數形狀是可選的。 如果存在,它指定所得張量的尺寸。 如果不存在,則使用值的形狀。

If the argument dtype is not specified, then the type is inferred from the type of value.
如果未指定參數dtype,則從值的類型推斷類型。

For example:

# 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]# Constant 2-D tensor populated with scalar value -1. tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.][-1. -1. -1.]]

tf.constant differs from tf.fill in a few ways:
tf.constant與tf.fill在以下方面有所不同:

  • tf.constant supports arbitrary constants, not just uniform scalar Tensors like tf.fill.
    tf.constant支持任意常量,而不僅僅是像tf.fill這樣的統一標量張量。

  • tf.constant creates a Const node in the computation graph with the exact value at graph construction time. On the other hand, tf.fill creates an Op in the graph that is expanded at runtime.
    tf.constant在計算圖中使用圖構建時的確切值創建一個Const節點。 另一方面,tf.fill在圖形中創建一個Op,并在運行時對其進行擴展。

  • Because tf.constant only embeds constant values in the graph, it does not support dynamic shapes based on other runtime Tensors, whereas tf.fill does.
    因為tf.constant僅將常數值嵌入到圖形中,所以它不支持基于其他運行時Tensor的動態形狀,而tf.fill則支持。

Args:

  • value: A constant value (or list) of output type dtype.
    輸出類型dtype的常量值(或列表)。

  • dtype: The type of the elements of the resulting tensor.
    所得張量的元素類型。

  • shape: Optional dimensions of resulting tensor.

  • name: Optional name for the tensor.
    張量的可選名稱。

  • verify_shape: Boolean that enables verification of a shape of values.
    布爾值,用于驗證值的形狀。

Returns:

  • A Constant Tensor.
    恒定張量。

Raises:

  • TypeError: if shape is incorrectly specified or unsupported.
    TypeError:如果形狀指定不正確或不受支持。

20200212

tf.constant()返回的結果是一個Tensor對象

import tensorflow as tf x = tf.constant([[1., 1.], [2., 2.]]) print(type(x))

結果:<class ‘tensorflow.python.framework.ops.Tensor’>

總結

以上是生活随笔為你收集整理的tensorflow1.11.0 tf.constant()函数(创建一个常数张量)的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 欧美色婷婷 | 亚洲AV无码精品黑人黑人 | 香蕉久久精品日日躁夜夜躁 | 国模叶桐尿喷337p人体 | 国产欧美色图 | 免费在线一级片 | 日韩a级一片 | www.久久色 | 在线一区二区三区视频 | 人妻无码一区二区三区久久 | 日韩一级成人 | 日韩有码在线观看 | 亚洲av成人片色在线观看高潮 | 精品免费视频 | 中文字幕在线免费播放 | 91亚洲一区二区三区 | 精品国产免费视频 | 亚洲精品一区二区口爆 | 精品美女久久久久 | 亚洲AV无码精品一区二区三区 | 成人性生交大片免费看 | 久久精品视频在线免费观看 | 无码人妻丰满熟妇啪啪网站 | 日本aaa视频| 精品久久久久久久久中文字幕 | 青青在线视频观看 | www.久热 | 久久亚洲成人av | 女教师高潮黄又色视频 | 黄频在线播放 | 91免费版视频 | 免费在线不卡视频 | 中文字幕av一区二区三区 | 老女人做爰全过程免费的视频 | 国产日韩欧美日韩大片 | 成人小视频免费看 | 97香蕉视频| 亚洲国产成人精品激情在线 | 最新国产黄色网址 | 欧美亚洲一区二区在线观看 | 国产精品免费一区二区三区 | 人妻 丝袜美腿 中文字幕 | 夜夜爽夜夜 | 国产美女无遮挡免费 | 国产69精品久久久 | 精品视频在线观看一区二区 | 午夜寂寞影视 | 中文字幕在线播放视频 | 三级av在线播放 | 成人中文网| 成人一区二区三区在线 | 四色成人av永久网址 | 菲律宾av| 免费成人深夜在线观看 | 91成人在线观看国产 | 国产黄色大片网站 | 欧美在线视频免费播放 | 丝袜熟女一区二区 | 在线观看欧美成人 | 国产91在线播放九色 | 日韩欧美视频在线播放 | 国产精品1024 | 日韩av无码一区二区三区 | 黄网站免费入口 | 这里精品 | 性少妇mdms丰满hdfilm | 日本人妖在线 | 在线视频免费播放 | 欧美日韩中文字幕一区 | 日韩性av | 91xxx在线观看| aaaaaa毛片 | 老女人做爰全过程免费的视频 | 你懂的在线观看视频 | 久久午夜无码鲁丝片午夜精品 | 高清成人免费视频 | 台湾佬美性中文娱乐网 | 国产91黄色| 国产精品视频福利 | 天堂av免费在线观看 | 午夜免费福利在线观看 | 天天想你在线观看完整版电影免费 | 亚洲性大片 | 国产理论影院 | 日日噜噜噜噜人人爽亚洲精品 | 国产黄色片在线免费观看 | 精品国自产在线观看 | 91在线高清 | 色欲一区二区三区精品a片 在线观看黄网站 | 村上里沙番号 | 在线波多野结衣 | 亚洲国产不卡 | 亚洲乱码一区二区三区在线观看 | 日本精品一区二区在线观看 | 中文在线免费看视频 | 麻豆av一区二区三区在线观看 | 男人手机天堂 | 欧美第一页在线观看 | aaa黄色一级片 |