public CPUNeuralNetwork(ICollection<ConnectableLayer> layers, CPUNNInitParameters parameters) : base(layers, parameters) { Contract.Requires(layers != null); Contract.Requires(layers.Count != 0); Contract.Requires(parameters != null); }
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); }
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); } } }
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; }