DeepLearning
RandomTensor
create a random Tensor
Calling Sequence
Parameters
Options
Description
Supported Distributions
Examples
Compatibility
RandomTensor(X,shape,opts)
X
-
function; probability distribution
opts
zero or more options as specified below
datatype = one of integer[4],integer[8],float[4],float[8]
The value of option datatype specifies the type of data this Tensor will hold. The default is float[4].
name = string
The value of option name specifies an optional name for this Tensor, to be displayed in output and when visualizing the dataflow graph.
seed = integer[8]
The value of option seed specifies an initial seed for the random number generator. It is equivalent to invoking SetRandomSeed(seed). For more information see SetRandomSeed.
The RandomTensor(X,shape,opts) command creates a random Tensor with shape shape using the probability distribution specified by X.
In the table below, a and b represent real-valued parameters. Unlike the Statistics package, symbolic parameters are not supported.
Distribution
Usage
Gamma
Gamma(a,b)
Gamma distribution with shape a and scale b
Normal
Normal(a,b)
Normal distribution with mean a and stddev b.
Poisson
Poisson(a)
Poisson distribution with parameter a
Truncated Normal
Truncated (a,b)
Normal distribution with mean a and stddev b with values more than 2 standard deviations from the mean removed
Uniform
Uniform(a,b)
Uniform distribution over interval [a,b].
This function is part of the DeepLearning package, so it can be used in the short form RandomTensor(..) only after executing the command with(DeepLearning). However, it can always be accessed through the long form of the command by using DeepLearning[RandomTensor](..).
with⁡DeepLearning:
t1≔RandomTensor⁡Gamma⁡1.5,2.7,10,2
t1≔DeepLearning TensorShape: [10, 2]Data Type: float[4]
Shape⁡t1
10,2
t2≔RandomTensor⁡Normal⁡1.,20.5,5,3
t2≔DeepLearning TensorShape: [5, 3]Data Type: float[4]
Shape⁡t2
5,3
The DeepLearning[RandomTensor] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
DeepLearning Overview
DeepLearning,SetRandomSeed
DeepLearning,Tensor,RandomCrop
Statistics,Sample
Download Help Document