Exemplo n.º 1
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);
        }
Exemplo n.º 2
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;
        }