伯努利¶
伯努利 - 22¶
版本¶
網域:
main
since_version:
22
函式:
True
支援層級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 22 起可用。
摘要¶
從伯努利分佈中抽取二元隨機數 (0 或 1)。輸入張量應該是包含機率 p 的張量(範圍 [0,1] 中的值),用於繪製二元隨機數,其中以機率 p 產生 1 的輸出,並以機率 (1-p) 產生 0 的輸出。
此運算符是非決定性的,並且在不同的實作中可能不會產生相同的值(即使指定了種子)。
屬性¶
dtype - INT :
輸出張量元素的資料類型。如果未指定,我們將使用輸入張量的資料類型。
seed - FLOAT :
(選用) 隨機產生器的種子,如果未指定,我們將自動產生一個。
輸入¶
input (異質) - T1
輸入中的所有值都必須在範圍:[0, 1] 中。
輸出¶
output (異質) - T2
返回的輸出張量只有值 0 或 1,與輸入張量具有相同的形狀。
類型約束¶
T1 在 (
tensor(bfloat16)
,tensor(double)
,tensor(float)
,tensor(float16)
)將輸入類型限制為浮點張量。
T2 在 (
tensor(bfloat16)
,tensor(bool)
,tensor(double)
,tensor(float)
,tensor(float16)
,tensor(int16)
,tensor(int32)
,tensor(int64)
,tensor(int8)
,tensor(uint16)
,tensor(uint32)
,tensor(uint64)
,tensor(uint8)
)將輸出類型限制為所有數值張量和布林張量。
伯努利 - 15¶
版本¶
網域:
main
since_version:
15
函式:
True
支援層級:
SupportType.COMMON
形狀推斷:
True
此版本的運算符自版本 15 起可用。
摘要¶
從伯努利分佈中抽取二元隨機數 (0 或 1)。輸入張量應該是包含機率 p 的張量(範圍 [0,1] 中的值),用於繪製二元隨機數,其中以機率 p 產生 1 的輸出,並以機率 (1-p) 產生 0 的輸出。
此運算符是非決定性的,並且在不同的實作中可能不會產生相同的值(即使指定了種子)。
屬性¶
dtype - INT :
輸出張量元素的資料類型。如果未指定,我們將使用輸入張量的資料類型。
seed - FLOAT :
(選用) 隨機產生器的種子,如果未指定,我們將自動產生一個。
輸入¶
input (異質) - T1
輸入中的所有值都必須在範圍:[0, 1] 中。
輸出¶
output (異質) - T2
返回的輸出張量只有值 0 或 1,與輸入張量具有相同的形狀。
類型約束¶
T1 在 (
tensor(double)
,tensor(float)
,tensor(float16)
)將輸入類型限制為浮點張量。
T2 在 (
tensor(bfloat16)
,tensor(bool)
,tensor(double)
,tensor(float)
,tensor(float16)
,tensor(int16)
,tensor(int32)
,tensor(int64)
,tensor(int8)
,tensor(uint16)
,tensor(uint32)
,tensor(uint64)
,tensor(uint8)
)將輸出類型限制為所有數值張量和布林張量。