/// <summary> /// Creates the neural network object from the user's inputted data /// </summary> private void initNN() { if (!this.isSynchronousNetwork) { this.asyncNN = new AsyncNeuralNetwork(this.neuronCounts, this.biasValues, this.asyncActivationTypes, this.numIntBits, this.numFracBits, this.numWeightIntBits, this.isClassifier, this.classifierThresholds, this.weights); this.syncNN = null; } else { this.syncNN = new SyncNeuralNetwork(this.neuronCounts, this.biasValues, this.syncActivationTypes, this.numIntBits, this.numFracBits, this.numWeightIntBits, this.isClassifier, this.classifierThresholds, this.weights); this.asyncNN = null; } }
private void TestSyncNNBtn_Click(object sender, EventArgs e) { List <double> weights = new List <double>(); /*first layer*/ weights.Add(0.0); weights.Add(1.0); weights.Add(-1.0); weights.Add(1.0); weights.Add(0.5); weights.Add(-0.5); /*Second layer*/ weights.Add(0.0); weights.Add(1.0); weights.Add(-1.0); weights.Add(1.0); weights.Add(1.0); weights.Add(0.5); SyncNeuralNetwork snn = new SyncNeuralNetwork(new int[] { 2, 2, 2 }, new double[] { -1, 1, 0 }, new TransferFunctionWrapper.MemoryActivationType[] { TransferFunctionWrapper.MemoryActivationType.UNIPOLAR_SIGMOID, TransferFunctionWrapper.MemoryActivationType.UNIPOLAR_SIGMOID }, 4, 4, 4, false, null, weights); string outFile = Directory.GetCurrentDirectory() + "\\proj\\"; System.IO.FileInfo f = new FileInfo(outFile); if (!File.Exists(outFile + "\\fixed_pkg.vhd")) { File.Copy("fixed_float_types.vhd", outFile + "\\fixed_float_types.vhd"); File.Copy("fixed_pkg.vhd", outFile + "\\fixed_pkg.vhd"); } f.Directory.Create(); if (!snn.writeVHDL(outFile)) { MessageBox.Show("Problem writing sync neural network"); } MessageBox.Show("File Written"); }