Пример #1
0
 public SoftMaxCostLayer(GPUModule gpuModule, FullyConnectedLayer previousLayer, DataLayer labelLayer, string id = "") : base(gpuModule, previousLayer, labelLayer, 0, id)
 {
     this.Size = previousLayer.Size;
     AddArray(ArrayName.CorrectlyPredictedLabels, MinibatchSize, 1);
     AddArray(ArrayName.Outputs, MinibatchSize, this.Size);
     _fullyConnectedLayer = previousLayer;
 }
Пример #2
0
 public SoftMaxCostLayer(GPUModule gpuModule, FullyConnectedLayer previousLayer, DataLayer labelLayer, string id = "") : base(gpuModule, previousLayer, labelLayer, 0, id)
 {
     this.Size = previousLayer.Size;
     AddArray(ArrayName.CorrectlyPredictedLabels, MinibatchSize, 1);
     AddArray(ArrayName.Outputs, MinibatchSize, this.Size);
     _fullyConnectedLayer = previousLayer;
 }
Пример #3
0
        public FullyConnectedLayer AddFullyConnectedLayer(int size, string id = "")
        {
            var lastLayer = Layers.Last();

            if (lastLayer == null)
            {
                throw new Exception("There must be one or more layers in the network");
            }
            var fcLayer = new FullyConnectedLayer(_gpuModule, lastLayer, size, id: id);

            Console.WriteLine("FC layer : " + fcLayer.Size + " weights : " + fcLayer.WeightsCPU.Length);
            Layers.Add(fcLayer);
            return(fcLayer);
        }
Пример #4
0
        public SoftMaxCostLayer AddSoftmaxLayer(int size, string id = "")
        {
            var lastLayer = Layers.Last();

            if (lastLayer == null)
            {
                throw new Exception("There must be one or more layers in the network");
            }
            if (CostLayer != null)
            {
                throw new Exception("There is already a cost layer");
            }

            var fcLayer = new FullyConnectedLayer(_gpuModule, lastLayer, size, id: id + "_fc");

            Layers.Add(fcLayer);
            var smLayer = new SoftMaxCostLayer(_gpuModule, fcLayer, this.LabelLayer, id: id);

            Layers.Add(smLayer);
            CostLayer = smLayer;
            return(smLayer);
        }
Пример #5
0
        public SoftMaxCostLayer AddSoftmaxLayer(int size, string id = "")
        {
            var lastLayer = Layers.Last();
            if (lastLayer == null) throw new Exception("There must be one or more layers in the network");
            if (CostLayer != null) throw new Exception("There is already a cost layer");

            var fcLayer = new FullyConnectedLayer(_gpuModule, lastLayer, size, id: id + "_fc");
            Layers.Add(fcLayer);
            var smLayer = new SoftMaxCostLayer(_gpuModule, fcLayer, this.LabelLayer, id: id);
            Layers.Add(smLayer);
            CostLayer = smLayer;
            return smLayer;
        }
Пример #6
0
 public FullyConnectedLayer AddFullyConnectedLayer(int size, string id = "")
 {
     var lastLayer = Layers.Last();
     if (lastLayer == null) throw new Exception("There must be one or more layers in the network");
     var fcLayer = new FullyConnectedLayer(_gpuModule, lastLayer, size, id: id);
     Console.WriteLine("FC layer : " + fcLayer.Size + " weights : " + fcLayer.WeightsCPU.Length);
     Layers.Add(fcLayer);
     return fcLayer;
 }