Пример #1
0
        public static ManagedLayerJSON Convert(ManagedLayer layer)
        {
            var model = new ManagedLayerJSON
            {
                Type = (int)layer.Type
            };

            if (layer.Type == LayerTypes.Convolution)
            {
                model.OutputMaps = layer.OutputMaps;
                model.KernelSize = layer.KernelSize;
                model.FeatureMap = Convert4DIJ(layer.FeatureMap);
                model.Bias       = Convert1D(layer.Bias);
            }
            else if (layer.Type == LayerTypes.Subsampling)
            {
                model.Scale = layer.Scale;
            }

            return(model);
        }
Пример #2
0
        // Add Layer and Initialize
        public void AddLayer(ManagedLayer layer)
        {
            if (layer.Type == LayerTypes.Input)
            {
                Layers.Add(layer);
            }

            if (layer.Type == LayerTypes.Subsampling)
            {
                if (layer.Scale > 0)
                {
                    Layers.Add(layer);
                }
            }

            if (layer.Type == LayerTypes.Convolution)
            {
                if (layer.KernelSize > 0 && layer.OutputMaps > 0)
                {
                    Layers.Add(layer);
                }
            }
        }