伯努利¶
伯努利 - 22¶
版本¶
名称: 伯努利 (GitHub)
域:
main
起始版本:
22
函数:
True
支持级别:
SupportType.COMMON
形状推断:
True
此版本的运算符自 版本 22 起可用。
摘要¶
从伯努利分布中抽取二元随机数(0 或 1)。输入张量应包含用于抽取二元随机数的概率 p(一个在 [0,1] 范围内的值),其中以概率 p 产生输出 1,以概率 (1-p) 产生输出 0。
此运算符是非确定性的,在不同的实现中可能不会产生相同的值(即使指定了种子)。
属性¶
dtype - INT :
输出张量元素的 DataTypes。如果未指定,我们将使用输入张量的数据类型。
种子 - 浮点型 :
(可选)随机生成器的种子,如果未指定,我们将自动生成一个。
输入¶
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¶
版本¶
名称: 伯努利 (GitHub)
域:
main
起始版本:
15
函数:
True
支持级别:
SupportType.COMMON
形状推断:
True
此版本的操作符自版本 15 起可用。
摘要¶
从伯努利分布中抽取二元随机数(0 或 1)。输入张量应包含用于抽取二元随机数的概率 p(一个在 [0,1] 范围内的值),其中以概率 p 产生输出 1,以概率 (1-p) 产生输出 0。
此运算符是非确定性的,在不同的实现中可能不会产生相同的值(即使指定了种子)。
属性¶
dtype - INT :
输出张量元素的 DataTypes。如果未指定,我们将使用输入张量的数据类型。
种子 - 浮点型 :
(可选)随机生成器的种子,如果未指定,我们将自动生成一个。
输入¶
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)
)将输出类型限制为所有数值张量和布尔张量。