DeepLearning - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : DeepLearning Package : Tensors : Managing Tensors : DeepLearning/RandomTensor

DeepLearning

  

RandomTensor

  

create a random Tensor

 

Calling Sequence

Parameters

Options

Description

Supported Distributions

Examples

Compatibility

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

withDeepLearning:

t1RandomTensorGamma1.5,2.7,10,2

t1DeepLearning TensorName: random_gamma/Maximum:0Shape: [10, 2]Data Type: float[4]

(1)

Shapet1

10,2

(2)

t2RandomTensorNormal1.,20.5,5,3

t2DeepLearning TensorName: random_normal:0Shape: [5, 3]Data Type: float[4]

(3)

Shapet2

5,3

(4)

Compatibility

• 

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