Esempio n. 1
0
        public static float[] ConcatenateVector(VectorBase src1, float[] src2)
        {
            var dest = new float[src1.Length + src2.Length];

            Parallel.Invoke(() => { src1.CopyTo().CopyTo(dest, 0); }
                            ,
                            () => { src2.CopyTo(dest, src1.Length); });

            return(dest);
        }
Esempio n. 2
0
        public static double[] ConcatenateVector(VectorBase src1, double[] src2)
        {
            double[] dest = new double[src1.Length + src2.Length];
            Parallel.Invoke(() =>
            {
                src1.CopyTo().CopyTo(dest, 0);
            }
                            ,
                            () =>
            {
                src2.CopyTo(dest, src1.Length);
            });

            return(dest);
        }
Esempio n. 3
0
        public void SetInputLayer(State state, int curState, int numStates, int[] predicted, bool forward = true)
        {
            if (predicted != null && state.RuntimeFeatures != null)
            {
                // set runtime feature
                for (int i = 0; i < state.RuntimeFeatures.Length; i++)
                {
                    for (int j = 0; j < L2; j++)
                    {
                        //Clean up run time feature value and then set a new one
                        state.SetRuntimeFeature(i, j, 0);
                    }

                    int pos = curState + ((forward == true) ? 1 : -1) * state.RuntimeFeatures[i].OffsetToCurrentState;
                    if (pos >= 0 && pos < numStates)
                    {
                        state.SetRuntimeFeature(i, predicted[pos], 1);
                    }
                }
            }

            neuFeatures = state.DenseData;
        }