public override double[] Perzertron_forward(double[] x) { double[] y = new double[weight_1_Small_Update_Gate.GetLength(0)]; double[] y_Left = new double[weight_1_Small_Update_Gate.GetLength(0)]; double[] y_Right = new double[weight_1_Small_Update_Gate.GetLength(0)]; double[] one = new double[weight_1_Small_Update_Gate.GetLength(0)]; for (int i = 0; i < one.Length; i++) { one[i] = 1; } double[] update_Cell = Update_Gate_1_Forward(x); double[] reset_Cell = Reset_Gate_2_Forward(x); double[] candidate_Cell = Candidate_Cell_Gate_3_Forward(x, reset_Cell); y_Left = Matrix_work.Vector_Multiplication_Adamar_Shur(Matrix_work.Vector_Substraction(one, update_Cell), candidate_Cell); y_Right = Matrix_work.Vector_Multiplication_Adamar_Shur(update_Cell, state_GRU); y = Matrix_work.Vector_Sum(y_Left, y_Right); Set_state_GRU(y); return(y); }
public override double[] Perzertron_forward(double[] x) { double[] y = new double[weight_1_Small_Candidate_Cell.GetLength(0)]; double[] candidate_Cell = Candidate_Cell_State_1_Forward(x); double[] input_Cell = Input_Gate_2_Forward(x); double[] forget_Cell = Forget_Gate_3_Forward(x); double[] output_cell = Output_Gate_4_Forward(x); double[] cell = Matrix_work.Vector_Sum(Matrix_work.Vector_Multiplication_Adamar_Shur(forget_Cell, state_LSTM_Memory), Matrix_work.Vector_Multiplication_Adamar_Shur(input_Cell, candidate_Cell)); Set_state_LSTM_Memory(cell); y = Matrix_work.Vector_Multiplication_Adamar_Shur(output_cell, Activation_Cell_Tanh(cell)); Set_state_LSTM(y); return(y); }