示例#1
0
 public CPUNeuralNetwork(ICollection<ConnectableLayer> layers, CPUNNInitParameters parameters)
     : base(layers, parameters)
 {
     Contract.Requires(layers != null);
     Contract.Requires(layers.Count != 0);
     Contract.Requires(parameters != null);
 }
示例#2
0
        internal void InitializeAlgo(BufferAllocator allocator, LearningRule rule, ConnectedLayer[] connectedLayers, CPUNNInitParameters initPars)
        {
            Contract.Requires(rule != null);
            Contract.Requires(connectedLayers != null);
            Contract.Requires(connectedLayers.Length > 0);
            Contract.Requires(initPars != null);

            Rule = rule;
            ConnectedLayers = connectedLayers;
            RunParallel = initPars.RunParallel;
            Ininitalize(allocator);
        }
示例#3
0
 private void BuildForwardComputation(BufferAllocator allocator, ConnectedLayerGroups connectedLayerGroups, CPUNNInitParameters initPars)
 {
     forwardComputeGroups = new LayerForwardCompute[connectedLayerGroups.Groups.Count][];
     for (int groupIndex = 0; groupIndex < connectedLayerGroups.Groups.Count; groupIndex++)
     {
         var group = connectedLayerGroups.Groups[groupIndex];
         forwardComputeGroups[groupIndex] = new LayerForwardCompute[group.Count];
         for (int layerIndex = 0; layerIndex < group.Count; layerIndex++)
         {
             forwardComputeGroups[groupIndex][layerIndex] = CreateLayerForwardCompute(group[layerIndex], initPars);
         }
     }
 }
示例#4
0
        private LayerForwardCompute CreateLayerForwardCompute(ConnectedLayer clayer, CPUNNInitParameters initPars)
        {
            LayerForwardCompute result = null;
            if (clayer.Layer is ActivationLayer)
            {
                result = new ActivationLayerForwardCompute(clayer);
            }
            
            if (result == null) throw new InvalidOperationException("Cannot build CPU Neural Network, because '" + clayer.Layer.GetType().FullName + "' layer type is unknown.");

            result.RunParallel = initPars.RunParallel;

            return result;
        }