Esempio n. 1
0
        public override Tensor Sample()
        {
            var t = new Tensor(Shape);

            for (int i = 0; i < Shape.Length; ++i)
            {
                t.SetFlat(Low.GetFlat(i) + (High.GetFlat(i) - Low.GetFlat(i)) * (float)GlobalRandom.Rng.NextDouble(), i);
            }
            return(t);
        }
Esempio n. 2
0
        public override bool Contains(Tensor state)
        {
            for (int i = 0; i < Shape.Length; ++i)
            {
                if (state.GetFlat(i) < Low.GetFlat(i) || state.GetFlat(i) > High.GetFlat(i))
                {
                    return(false);
                }
            }

            return(true);
        }