 RandomCrop - Maple Help

# Online Help

###### All Products    Maple    MapleSim

DeepLearning/Tensor/RandomCrop

randomly shuffle a Tensor to specified shape

DeepLearning/Tensor/RandomShuffle

randomly shuffle a Tensor along its first dimension Calling Sequence RandomCrop(t,shape,opts) RandomShuffle(t,opts) Parameters

 t - Tensor shape - list of integers opts - zero or more options as specified below Options

 • 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

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 RandomCrop(t,shape,opts) command constructs a Tensor with shape shape by randomly slicing data from t with uniform probability.
 • The RandomShuffle(t,opts) command randomly shuffles a Tensor along its first dimension. Examples

Crop a random 3x2 slice from a 4x3 Tensor.

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $C≔\mathrm{Constant}\left(⟨⟨3.5,7.9,-0.5,1⟩|⟨-3.8,-4.2,9.5,3⟩|⟨4.,-7.2,-8.2,2⟩⟩\right)$
 ${C}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: none}}\\ {\mathrm{Shape: undefined}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (1)
 > $\mathrm{t1}≔\mathrm{RandomCrop}\left(C,\left[3,2\right]\right)$
 ${\mathrm{t1}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: none}}\\ {\mathrm{Shape: undefined}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (2)
 > $\mathrm{Shape}\left(\mathrm{t1}\right)$
 ${\mathrm{undefined}}$ (3)

Shuffle a Tensor along its first dimension.

 > $\mathrm{t2}≔\mathrm{RandomShuffle}\left(C\right)$
 ${\mathrm{t2}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Tensor}}\\ {\mathrm{Name: none}}\\ {\mathrm{Shape: undefined}}\\ {\mathrm{Data Type: float\left[8\right]}}\end{array}\right]$ (4) Compatibility

 • The DeepLearning/Tensor/RandomCrop and DeepLearning/Tensor/RandomShuffle commands were introduced in Maple 2018.
 • For more information on Maple 2018 changes, see Updates in Maple 2018.

 See Also