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)); }
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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <summary> /// Gets the seed. /// </summary> /// <param name="src">The source.</param> /// <returns>System.Nullable<System.Int32>.</returns> private static int?GetSeed(SeedSource src) { return(src == null ? (int?)null : src.NextSeed()); }