Ejemplo n.º 1
0
 public MyRBMAgent(MyAbstractFeedForwardNode network, int nGPU, MyMemoryBlock <float> labelInput, uint learningDuration)
     : base(network)
 {
     layers = new List <MyAbstractFBLayer>();
     foreach (MyAbstractFBLayer l in network.Layers)
     {
         MyNeuronLayer nl = l as MyNeuronLayer;
         if (nl != null)
         {
             layers.Add(nl);
         }
         MyNeuronCopyLayer ncl = l as MyNeuronCopyLayer;
         if (ncl != null)
         {
             layers.Add(ncl);
         }
     }
     totalSteps = (int)learningDuration * (layers.Count - 1);
 }
Ejemplo n.º 2
0
        private MyAbstractWeightLayer BuildNetworkLayerNeuronCopy(XmlNode layerItem)
        {
            uint nbNeurons = 0;

            bool nbNeuronsMissing = true;

            // Parse
            foreach (XmlAttribute layerAttribute in layerItem.Attributes)
            {
                switch (layerAttribute.Name)
                {
                case "nbneurons":
                    nbNeurons        = uint.Parse(layerAttribute.Value);
                    nbNeuronsMissing = false;
                    break;

                default:
                    throw new MyXMLBuilderException("Unknown attribute: " + layerAttribute.Name);
                }
            }

            // Validate values
            if (nbNeuronsMissing)
            {
                throw new MyXMLBuilderException("Missing nbNeurons parameter");
            }

            if (nbNeurons == 0)
            {
                throw new MyXMLBuilderException("Must have at least 1 neuron");
            }

            // Success!
            float[] initialWeight       = null;
            float[] initialBias         = null;
            MyAbstractWeightLayer layer = new MyNeuronCopyLayer(m_network, nbNeurons, initialWeight, initialBias);

            m_network.AddLayer(layer);
            return(layer);
        }