Exemplo n.º 1
0
        public Tensor RandomNormal(long[] shape, float mean, float stddev, int?seed = null)
        {
            var result     = new NDArray(DeviceManager.Current, DType.Float32, shape);
            var seedSource = new SeedSource();

            if (seed.HasValue)
            {
                seedSource = new SeedSource(seed.Value);
            }
            TOps.RandomNormal(result, seedSource, mean, stddev);
            return(Out(result));
        }
Exemplo n.º 2
0
        public Tensor RandomUniform(long[] shape, float min, float max, int?seed = null)
        {
            var result     = new NDArray(DeviceManager.Current, DType.Float32, shape);
            var seedSource = new SeedSource();

            if (seed.HasValue)
            {
                seedSource = new SeedSource(seed.Value);
            }

            TOps.RandomUniform(result, seedSource, min, max);
            return(Out(result));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Randoms the bernoulli.
 /// </summary>
 /// <param name="result">The result.</param>
 /// <param name="seedSource">The seed source.</param>
 /// <param name="p">The p.</param>
 public static void RandomBernoulli(NDArray result, SeedSource seedSource, float p)
 {
     OpRegistry.Invoke("random_bernoulli", result, GetSeed(seedSource), p);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Randoms the geometric.
 /// </summary>
 /// <param name="result">The result.</param>
 /// <param name="seedSource">The seed source.</param>
 /// <param name="p">The p.</param>
 public static void RandomGeometric(NDArray result, SeedSource seedSource, float p)
 {
     OpRegistry.Invoke("random_geometric", result, GetSeed(seedSource), p);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Randoms the log normal.
 /// </summary>
 /// <param name="result">The result.</param>
 /// <param name="seedSource">The seed source.</param>
 /// <param name="mean">The mean.</param>
 /// <param name="stdv">The STDV.</param>
 public static void RandomLogNormal(NDArray result, SeedSource seedSource, float mean, float stdv)
 {
     OpRegistry.Invoke("random_lognormal", result, GetSeed(seedSource), mean, stdv);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Randoms the cauchy.
 /// </summary>
 /// <param name="result">The result.</param>
 /// <param name="seedSource">The seed source.</param>
 /// <param name="median">The median.</param>
 /// <param name="sigma">The sigma.</param>
 public static void RandomCauchy(NDArray result, SeedSource seedSource, float median, float sigma)
 {
     OpRegistry.Invoke("random_cauchy", result, GetSeed(seedSource), median, sigma);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Randoms the exponential.
 /// </summary>
 /// <param name="result">The result.</param>
 /// <param name="seedSource">The seed source.</param>
 /// <param name="lambda">The lambda.</param>
 public static void RandomExponential(NDArray result, SeedSource seedSource, float lambda)
 {
     OpRegistry.Invoke("random_exponential", result, GetSeed(seedSource), lambda);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Randoms the uniform.
 /// </summary>
 /// <param name="result">The result.</param>
 /// <param name="seedSource">The seed source.</param>
 /// <param name="min">The minimum.</param>
 /// <param name="max">The maximum.</param>
 public static void RandomUniform(NDArray result, SeedSource seedSource, float min, float max)
 {
     OpRegistry.Invoke("random_uniform", result, GetSeed(seedSource), min, max);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Gets the seed.
 /// </summary>
 /// <param name="src">The source.</param>
 /// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
 private static int?GetSeed(SeedSource src)
 {
     return(src == null ? (int?)null : src.NextSeed());
 }