Bernoulli¶
Bernoulli - 22¶
版本¶
领域:
main
起始版本:
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)
) 中将输出类型限制为所有数值张量和布尔张量。
Bernoulli - 15¶
版本¶
领域:
main
起始版本:
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)
) 中将输出类型限制为所有数值张量和布尔张量。