RandomNormal#
Domain:
ai.onnxSince version: 22
Generate a tensor with random values drawn from a normal distribution. The shape
of the tensor is specified by the shape argument and the parameter of the normal distribution
specified by mean and scale.
The data type is specified by the ‘dtype’ argument. The ‘dtype’ argument must be one of the data types specified in the ‘DataType’ enum field in the TensorProto message.
Outputs
output (T): Output tensor of random values drawn from normal distribution
Attributes
dtype (int): The data type for the elements of the output tensor. Default is TensorProto::FLOAT.
mean (float): The mean of the normal distribution.
scale (float): The standard deviation of the normal distribution.
seed (float): (Optional) Seed to the random generator, if not specified we will auto generate one.
shape (int[]): The shape of the output tensor.
Type Constraints
T: Constrain output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).
Examples#
test_cc_randomnormal
Node:
RandomNormal() -> (y)
Attributes:
shape = [2, 3]
Inputs:
Outputs:
y: shape=(2, 3), dtype=float32
[[ 0.04646347, 1.3829458 , 0.1371488 ],
[-1.691909 , 0.6007101 , 0.24345492]]
test_cc_randomnormal_double
Node:
RandomNormal() -> (y)
Attributes:
dtype = 11
shape = [2, 3]
Inputs:
Outputs:
y: shape=(2, 3), dtype=float64
[[ 0.04646347, 1.38294577, 0.1371488 ],
[-1.69190901, 0.60071012, 0.24345492]]
test_cc_randomnormal_seeded
Node:
RandomNormal() -> (y)
Attributes:
mean = 1.0
scale = 2.0
seed = 42.0
shape = [2, 3]
Inputs:
Outputs:
y: shape=(2, 3), dtype=float32
[[-7.8826690e-01, 6.6930413e-02, 4.1850791e+00],
[-2.7278478e+00, 2.0848513e-03, 4.0150185e+00]]
Differences with previous version (1)#
SchemaDiff: RandomNormal (domain 'ai.onnx')
old version: 1
new version: 22
breaking: no
Type constraints:
changed ‘T’: added types: [‘tensor(bfloat16)’]