Tensor.CreateRandom Method

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.0
Creates a tensor with random values.

Overload List

CreateRandom(TensorShape, ArrayMutability) Constructs a new tensor with uniform random numbers between 0 and 1.
CreateRandom(TensorShape, Random, ArrayMutability) Constructs a new tensor with uniform random numbers between 0 and 1.

CreateRandom(TensorShape, ArrayMutability)

Constructs a new tensor with uniform random numbers between 0 and 1.
C#
public static Tensor<double> CreateRandom(
	TensorShape shape,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

shape  TensorShape
The shape of the tensor.
mutability  ArrayMutability  (Optional)
Optional. Specifies how the tensor's values may be changed. The default is mutable values.

Return Value

Tensor<Double>
A DenseTensor.

Exceptions

ArgumentException

shape is not a valid tensor shape.

CreateRandom(TensorShape, Random, ArrayMutability)

Constructs a new tensor with uniform random numbers between 0 and 1.
C#
public static Tensor<double> CreateRandom(
	TensorShape shape,
	Random random,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

shape  TensorShape
The shape of the tensor.
random  Random
The random number generator to use.
mutability  ArrayMutability  (Optional)
Optional. Specifies how the tensor's values may be changed. The default is mutable values.

Return Value

Tensor<Double>
A DenseTensor.

Exceptions

ArgumentException

shape is not a valid tensor shape.

See Also