RandomTensor - Maple Help

DeepLearning

 RandomTensor
 create a random Tensor

 Calling Sequence RandomTensor(X,shape,opts)

Parameters

 X - function; probability distribution opts - zero or more options as specified below

Options

 • 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.

Description

 • The RandomTensor(X,shape,opts) command creates a random Tensor with shape shape using the probability distribution specified by X.

Supported Distributions

 • In the table below, a and b represent real-valued parameters. Unlike the Statistics package, symbolic parameters are not supported.

 Distribution Usage Description 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](..).

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $\mathrm{t1}≔\mathrm{RandomTensor}\left(\mathrm{Gamma}\left(1.5,2.7\right),\left[10,2\right]\right)$
 ${\mathrm{t1}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: none}}\\ {\mathrm{Shape: undefined}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (1)
 > $\mathrm{Shape}\left(\mathrm{t1}\right)$
 ${\mathrm{undefined}}$ (2)
 > $\mathrm{t2}≔\mathrm{RandomTensor}\left(\mathrm{Normal}\left(1.,20.5\right),\left[5,3\right]\right)$
 ${\mathrm{t2}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: none}}\\ {\mathrm{Shape: undefined}}\\ {\mathrm{Data Type: float\left[4\right]}}\end{array}\right]$ (3)
 > $\mathrm{Shape}\left(\mathrm{t2}\right)$
 ${\mathrm{undefined}}$ (4)

Compatibility

 • The DeepLearning[RandomTensor] command was introduced in Maple 2018.
 • For more information on Maple 2018 changes, see Updates in Maple 2018.