Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- namespace YounGenTech.NeuralNetwork {
- [System.Serializable]
- public class Layer {
- [SerializeField]
- Neuron[] _neurons;
- public int Count {
- get { return _neurons.Length; }
- }
- public float[] LastOutput { get; protected set; }
- public Neuron this[int index] {
- get { return _neurons[index]; }
- }
- public Layer(params Neuron[] neurons) {
- SetNeurons(neurons);
- }
- public float[] Output(float[] data) {
- float[] newData = new float[Count];
- for(int i = 0; i < Count; i++)
- newData[i] = _neurons[i].Output(data);
- LastOutput = newData;
- return newData;
- }
- public void SetNeurons(params Neuron[] neurons) {
- _neurons = neurons;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment