module onnxrt.ops_cpu.op_random
#
Short summary#
module mlprodict.onnxrt.ops_cpu.op_random
Runtime operator.
Classes#
class |
truncated documentation |
---|---|
Common methods to all random operators. |
|
Bernoulli ========= Draws binary random numbers (0 or 1) from a Bernoulli distribution. The input tensor should be a tensor … |
|
RandomNormal ============ Generate a tensor with random values drawn from a normal distribution. The shape of the tensor … |
|
RandomNormalLike ================ Generate a tensor with random values drawn from a normal distribution. The shape of … |
|
RandomUniform ============= Generate a tensor with random values drawn from a uniform distribution. The shape of the tensor … |
|
RandomUniformLike ================= Generate a tensor with random values drawn from a uniform distribution. The shape … |
Properties#
property |
truncated documentation |
---|---|
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
Methods#
method |
truncated documentation |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Documentation#
Runtime operator.
- class mlprodict.onnxrt.ops_cpu.op_random.Bernoulli(onnx_node, desc=None, **options)#
Bases:
_CommonRandom
Draws binary random numbers (0 or 1) from a Bernoulli distribution. The input tensor should be a tensor containing probabilities p (a value in the range [0,1]) to be used for drawing the binary random number, where an output of 1 is produced with probability p and an output of 0 is produced with probability (1-p).
This operator is non-deterministic and may not produce the same values in different implementations (even if a seed is specified).
Attributes
dtype: The data type for the elements of the output tensor. if not specified, we will use the data type of the input tensor. default value cannot be automatically retrieved (INT)
seed: (Optional) Seed to the random generator, if not specified we will auto generate one. default value cannot be automatically retrieved (FLOAT)
Inputs
input (heterogeneous)T1: All values in input have to be in the range:[0, 1].
Outputs
output (heterogeneous)T2: The returned output tensor only has values 0 or 1, same shape as input tensor.
Type Constraints
T1 tensor(float16), tensor(float), tensor(double): Constrain input types to float tensors.
T2 tensor(float16), tensor(float), tensor(double), tensor(bfloat16), tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(bool): Constrain output types to all numeric tensors and bool tensors.
Version
Onnx name: Bernoulli
This version of the operator has been available since version 15.
Runtime implementation:
Bernoulli
- __init__(onnx_node, desc=None, **options)#
- _run(x, attributes=None, verbose=0, fLOG=None)#
Should be overwritten.
- to_python(inputs)#
Returns a python code equivalent to this operator.
- Parameters:
inputs – inputs name
- Returns:
imports, python code, both as strings
- class mlprodict.onnxrt.ops_cpu.op_random.RandomNormal(onnx_node, desc=None, **options)#
Bases:
_CommonRandom
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.
Attributes
dtype: The data type for the elements of the output tensor. Default is TensorProto::FLOAT. Default value is
namedtypei1typeINT
(INT)mean: The mean of the normal distribution. Default value is
namemeanf0.0typeFLOAT
(FLOAT)scale: The standard deviation of the normal distribution. Default value is
namescalef1.0typeFLOAT
(FLOAT)seed: (Optional) Seed to the random generator, if not specified we will auto generate one. default value cannot be automatically retrieved (FLOAT)
shape (required): The shape of the output tensor. default value cannot be automatically retrieved (INTS)
Outputs
output (heterogeneous)T: Output tensor of random values drawn from normal distribution
Type Constraints
T tensor(float16), tensor(float), tensor(double): Constrain output types to float tensors.
Version
Onnx name: RandomNormal
This version of the operator has been available since version 1.
Runtime implementation:
RandomNormal
- __init__(onnx_node, desc=None, **options)#
- _run(*args, attributes=None, verbose=0, fLOG=None)#
Should be overwritten.
- to_python(inputs)#
Returns a python code equivalent to this operator.
- Parameters:
inputs – inputs name
- Returns:
imports, python code, both as strings
- class mlprodict.onnxrt.ops_cpu.op_random.RandomNormalLike(onnx_node, desc=None, **options)#
Bases:
_CommonRandom
Generate a tensor with random values drawn from a normal distribution. The shape of the output tensor is copied from the shape of the input tensor, and the parameters of the normal distribution are specified by mean and scale.
The data type is specified by the ‘dtype’ argument, or copied from the input tensor if not provided. The ‘dtype’ argument must be one of the data types specified in the ‘DataType’ enum field in the TensorProto message, and be valid as an output type.
Attributes
dtype: (Optional) The data type for the elements of the output tensor, if not specified, we will use the data type of the input tensor. default value cannot be automatically retrieved (INT)
mean: The mean of the normal distribution. Default value is
namemeanf0.0typeFLOAT
(FLOAT)scale: The standard deviation of the normal distribution. Default value is
namescalef1.0typeFLOAT
(FLOAT)seed: (Optional) Seed to the random generator, if not specified we will auto generate one. default value cannot be automatically retrieved (FLOAT)
Inputs
input (heterogeneous)T1: Input tensor to copy shape and optionally type information from.
Outputs
output (heterogeneous)T2: Output tensor of random values drawn from normal distribution
Type Constraints
T1 tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128): Constrain to any tensor type. If the dtype attribute is not provided this must be a valid output type.
T2 tensor(float16), tensor(float), tensor(double): Constrain output types to float tensors.
Version
Onnx name: RandomNormalLike
This version of the operator has been available since version 1.
Runtime implementation:
RandomNormalLike
- __init__(onnx_node, desc=None, **options)#
- _run(x, attributes=None, verbose=0, fLOG=None)#
Should be overwritten.
- to_python(inputs)#
Returns a python code equivalent to this operator.
- Parameters:
inputs – inputs name
- Returns:
imports, python code, both as strings
- class mlprodict.onnxrt.ops_cpu.op_random.RandomUniform(onnx_node, desc=None, **options)#
Bases:
_CommonRandom
Generate a tensor with random values drawn from a uniform distribution. The shape of the tensor is specified by the shape argument and the range by low and high.
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.
Attributes
dtype: The data type for the elements of the output tensor. If not specified, default is TensorProto::FLOAT. Default value is
namedtypei1typeINT
(INT)high: Upper boundary of the output values. Default value is
namehighf1.0typeFLOAT
(FLOAT)low: Lower boundary of the output values. Default value is
namelowf0.0typeFLOAT
(FLOAT)seed: (Optional) Seed to the random generator, if not specified we will auto generate one. default value cannot be automatically retrieved (FLOAT)
shape (required): The shape of the output tensor. default value cannot be automatically retrieved (INTS)
Outputs
output (heterogeneous)T: Output tensor of random values drawn from uniform distribution
Type Constraints
T tensor(float16), tensor(float), tensor(double): Constrain output types to float tensors.
Version
Onnx name: RandomUniform
This version of the operator has been available since version 1.
Runtime implementation:
RandomUniform
- __init__(onnx_node, desc=None, **options)#
- _run(*args, attributes=None, verbose=0, fLOG=None)#
Should be overwritten.
- to_python(inputs)#
Returns a python code equivalent to this operator.
- Parameters:
inputs – inputs name
- Returns:
imports, python code, both as strings
- class mlprodict.onnxrt.ops_cpu.op_random.RandomUniformLike(onnx_node, desc=None, **options)#
Bases:
_CommonRandom
Generate a tensor with random values drawn from a uniform distribution. The shape of the output tensor is copied from the shape of the input tensor, and the parameters of the uniform distribution are specified by low and high.
The data type is specified by the ‘dtype’ argument, or copied from the input tensor if not provided. The ‘dtype’ argument must be one of the data types specified in the ‘DataType’ enum field in the TensorProto message and be valid as an output type.
Attributes
dtype: (Optional) The data type for the elements of the output tensor, if not specified, we will use the data type of the input tensor. default value cannot be automatically retrieved (INT)
high: Upper boundary of the output values. Default value is
namehighf1.0typeFLOAT
(FLOAT)low: Lower boundary of the output values. Default value is
namelowf0.0typeFLOAT
(FLOAT)seed: (Optional) Seed to the random generator, if not specified we will auto generate one. default value cannot be automatically retrieved (FLOAT)
Inputs
input (heterogeneous)T1: Input tensor to copy shape and optionally type information from.
Outputs
output (heterogeneous)T2: Output tensor of random values drawn from uniform distribution
Type Constraints
T1 tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128): Constrain to any tensor type. If the dtype attribute is not provided this must be a valid output type.
T2 tensor(float16), tensor(float), tensor(double): Constrain output types to float tensors.
Version
Onnx name: RandomUniformLike
This version of the operator has been available since version 1.
Runtime implementation:
RandomUniformLike
- __init__(onnx_node, desc=None, **options)#
- _run(x, attributes=None, verbose=0, fLOG=None)#
Should be overwritten.
- to_python(inputs)#
Returns a python code equivalent to this operator.
- Parameters:
inputs – inputs name
- Returns:
imports, python code, both as strings