RandomArrayLayer
RandomArrayLayer[dist]
represents a net layer that has no input and produces a random array from the univariate distribution dist.
RandomArrayLayer[dfunc]
uses the univariate distribution dfunc[input] for each input value.
Details and Options
- In RandomArrayLayer[dist], the distribution dist can be any one of the following univariate distributions: NormalDistribution, UniformDistribution, GammaDistribution, ExponentialDistribution, PoissonDistribution, MaxwellDistribution, RayleighDistribution, ChiDistribution, HalfNormalDistribution, WeibullDistribution, NakagamiDistribution, ChiSquareDistribution, ErlangDistribution, LogGammaDistribution, ExpGammaDistribution, InverseGammaDistribution, BernoulliDistribution, BinomialDistribution, NegativeBinomialDistribution or DiscreteUniformDistribution.
- RandomArrayLayer[dist][] generates a random array or scalar, depending on the output shape.
- In RandomArrayLayer[dfunc], the number of input ports in the layer is the number of arguments of the function dfunc.
- In RandomArrayLayer[dfunc], the output will be an array consisting of independent draws of the corresponding distributions, whose parameters are taken elementwise from the input arrays.
- RandomArrayLayer[Function[… #Name1 … #Name2 …], …] exposes input ports named "Name1", "Name2", etc.
- Besides input ports, RandomArrayLayer exposes the following ports for use in NetGraph etc.:
-
"Output" an array - RandomArrayLayer[…,"port"shape] can be used as in NetGraph to specify the shape, encoder or decoder of a given port.
- Options[RandomArrayLayer] gives the list of default options to construct the layer. Options[RandomArrayLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[RandomArrayLayer[…]] gives a report about the layer.
- Information[RandomArrayLayer[…],prop] gives the value of the property prop of RandomArrayLayer[…]. Possible properties are the same as for NetGraph.
Examples
open allclose allBasic Examples (2)
Scope (3)
Arguments (2)
Create a layer that draws real numbers from independent normal distributions whose means and standard deviations are determined by the inputs:
Sample a random vector with given values for the mean and the standard deviation of the Gaussian distribution:
Create the same layer with custom input port names:
Sample random numbers with this layer:
Applications (2)
Build a network that sums an array and a random vector drawn from a Gaussian distribution:
Apply the net to lists of different lengths:
Derive a network that adds noise to images, by attaching an input NetEncoder and an output NetDecoder:
Build a network that masks a vector of integers with a particular integer value, with a probability to switch a value of 0.3:
Text
Wolfram Research (2020), RandomArrayLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomArrayLayer.html.
CMS
Wolfram Language. 2020. "RandomArrayLayer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomArrayLayer.html.
APA
Wolfram Language. (2020). RandomArrayLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomArrayLayer.html