Esempio n. 1
0
        public void RestoreWeights(object savedWeights)
        {
            SavedWeights save = (SavedWeights)savedWeights;

            hiddenLayer.IncomingWeights = save.HiddenWeights.Clone();
            outputLayer.IncomingWeights = save.OutputWeights.Clone();

            hiddenLayer.BiasWeights = save.HiddenBias.Clone();
            outputLayer.BiasWeights = save.OutputBias.Clone();

            contextLayer.Memory = save.Memory.Clone();
        }
Esempio n. 2
0
        public object SaveWeights()
        {
            SavedWeights save = new SavedWeights();

            save.HiddenWeights = hiddenLayer.IncomingWeights.Clone();
            save.OutputWeights = outputLayer.IncomingWeights.Clone();

            save.HiddenBias = hiddenLayer.BiasWeights.Clone();
            save.OutputBias = outputLayer.BiasWeights.Clone();

            save.Memory = contextLayer.Memory.Clone();

            return(save);
        }
Esempio n. 3
0
        public object SaveWeights()
        {
            SavedWeights save = new SavedWeights(weightedLayers.Count);

            for (int i = 0; i < weightedLayers.Count; i++)
            {
                save.WeightMatrices[i] = weightedLayers[i].IncomingWeights.Clone();
                if (weightedLayers[i].HasBias)
                {
                    save.Biases[i] = weightedLayers[i].BiasWeights.Clone();
                }
            }

            return(save);
        }
Esempio n. 4
0
        public void RestoreWeights(object savedWeights)
        {
            SavedWeights save = (SavedWeights)savedWeights;

            if (save.WeightMatrices.Length != weightedLayers.Count)
            {
                throw new ArgumentException("The number of saved matrices is different than the number of weight layers");
            }

            for (int i = 0; i < weightedLayers.Count; i++)
            {
                weightedLayers[i].IncomingWeights = save.WeightMatrices[i].Clone();
                if (weightedLayers[i].HasBias)
                {
                    weightedLayers[i].BiasWeights = save.Biases[i].Clone();
                }
            }
        }