コード例 #1
0
ファイル: SiaNetBackend.cs プロジェクト: zhuthree/SiaNet
 public Tensor RandomUniform(long[] shape, float min, float max, int?seed = null)
 {
     if (seed.HasValue)
     {
         return(Out(C.UniformRandom(BackendUtil.CastShapeInt(shape), CNTK.DataType.Float, min, max, (uint)seed.Value)));
     }
     else
     {
         return(Out(C.UniformRandom(BackendUtil.CastShapeInt(shape), CNTK.DataType.Float, min, max)));
     }
 }
コード例 #2
0
        public Tensor random_uniform(int?[] shape, double minval = 0, double maxval = 1, DataType?dtype = null, int?seed = null, string name = null)
        {
            if (dtype == null)
            {
                dtype = floatx();
            }

            if (seed == null)
            {
                // ensure that randomness is conditioned by the Accord RNG
                seed = Accord.Math.Random.Generator.Random.Next(10_000);
            }

            return(Out(C.UniformRandom(shape: InShape(shape), dataType: In(dtype.Value),
                                       low: minval, high: maxval, seed: (uint)seed.Value, name: In(name))));
        }