Esempio n. 1
0
        public void TensorDataSource()
        {
            var tensors    = Enumerable.Range(0, 10).Select(k => FloatTensor.Create(Enumerable.Range(0, 10).Select(j => FloatMatrix.Create(Enumerable.Range(0, 10).Select(i => FloatVector.Create(GetArray(i, 10))).ToArray())).ToArray())).ToList();
            var dataSource = _factory.CreateDataSource(tensors);
            var miniBatch  = dataSource.Get(null, new[] { 0, 1, 2 });

            var currentSequence = miniBatch.CurrentSequence;
            var batchMatrix     = currentSequence.Input[0].GetMatrix();

            Assert.IsNull(currentSequence.Target);
            Assert.IsTrue(batchMatrix.RowCount == 1000);
            Assert.IsTrue(batchMatrix.ColumnCount == 3);
            Assert.AreEqual(batchMatrix.Row(0).GetAt(0), 0f);
        }