Exemple #1
0
 protected override void DoExecuteVectorFlow(VectorComputationContext context, VectorBuffer<float> vectorBuffer, Core.Vectors.VectorFlow<float> vectorFlow)
 {
     var ctx = (NeuralComputationContext)context;
     if (Network.IsRecurrent) Network.Reset(ctx, NeuralNetworkResetTarget.Outputs);
     base.DoExecuteVectorFlow(context, vectorBuffer, vectorFlow);
 }
Exemple #2
0
 public void AddBuffer(string name, VectorBuffer buffer)
 {
     vectorBuffers.Add(name, buffer);
 }
Exemple #3
0
        // Batch Iteration:
        protected override void ExecuteBatchIteration(VectorComputationContext context, VectorBuffer<float> vectorBuffer, VectorFlowBatch<float> batch)
        {
            var ctx = (NeuralComputationContext)context;

            // Begin of batch:
            ctx.Training_BeginOfBatch = true;

            if (Mode == TrainingMode.Unordered)
            {
                // Reset backward values, and clear error information:
                ResetGradientComputingValues(ctx);
                ctx.Training_NumberOfIterationsInBatch = 0;
            }

            base.ExecuteBatchIteration(context, vectorBuffer, batch);

            // Batch done, iterate algos:
            Network.CallErrorBasedBatchLearningAlgorithms(ctx, ctx.Training_NumberOfIterationsInBatch, AverageErrorBuffer);
        }
Exemple #4
0
        // A Flow:
        protected override void DoExecuteVectorFlow(VectorComputationContext context, VectorBuffer<float> vectorBuffer, VectorFlow<float> vectorFlow)
        {
            var ctx = (NeuralComputationContext)context;

            if (Mode == TrainingMode.Unordered)
            {
                // Reset forward values:
                ResetNetworkValues(ctx);

                // Reset backward errors and gradients:
                // If beginOfBatch == true, 
                // backward errors and gradients already reseted by a ResetBackwardValues() call
                if (!ctx.Training_BeginOfBatch)
                {
                    ResetPartialGradientComputingValues(ctx);
                }
            }
            
            // Begin of recurrent flow:
            ctx.Training_BPTTEllapsedForwardIterationCount = 0;

            base.DoExecuteVectorFlow(context, vectorBuffer, vectorFlow);

            ctx.Training_BeginOfBatch = false;
        }
Exemple #5
0
        // Batch Iterations (all repeated):
        protected override void DoExecuteBatch(VectorComputationContext context, VectorBuffer<float> vectorBuffer, VectorFlowBatch<float> batch)
        {
            // This is where batch iterations begins

            var ctx = (NeuralComputationContext)context;

            EnsureInitialized(ctx);

            var neuralBatch = batch as NeuralVectorFlowBatch;

            if (neuralBatch != null && Mode == TrainingMode.Streamed && neuralBatch.ResetSchedule == ResetSchedule.BeforeExecution)
            {
                // Streamed reset scheduled:
                ResetAll(ctx);
            }

            base.DoExecuteBatch(context, vectorBuffer, batch);

            if (neuralBatch != null && Mode == TrainingMode.Streamed && neuralBatch.ResetSchedule == ResetSchedule.AfterExecution)
            {
                // Streamed reset scheduled:
                ResetAll(ctx);
            }
        }