public void MergeFrom(Layer other) { if (other == null) { return; } if (other.LayerInputDim != 0) { LayerInputDim = other.LayerInputDim; } if (other.LayerOutputDim != 0) { LayerOutputDim = other.LayerOutputDim; } if (other.layerInputWeight_ != null) { if (layerInputWeight_ == null) { layerInputWeight_ = new global::Apollo.Prediction.Matrix(); } LayerInputWeight.MergeFrom(other.LayerInputWeight); } if (other.layerBias_ != null) { if (layerBias_ == null) { layerBias_ = new global::Apollo.Prediction.Vector(); } LayerBias.MergeFrom(other.LayerBias); } if (other.LayerActivationFunc != 0) { LayerActivationFunc = other.LayerActivationFunc; } }
public override int GetHashCode() { int hash = 1; if (LayerInputDim != 0) { hash ^= LayerInputDim.GetHashCode(); } if (LayerOutputDim != 0) { hash ^= LayerOutputDim.GetHashCode(); } if (layerInputWeight_ != null) { hash ^= LayerInputWeight.GetHashCode(); } if (layerBias_ != null) { hash ^= LayerBias.GetHashCode(); } if (LayerActivationFunc != 0) { hash ^= LayerActivationFunc.GetHashCode(); } return(hash); }
private void InitializeParameters(int[] layerDimensions) { for (var currentLayer = 1; currentLayer < layerDimensions.Length; currentLayer++) { LayerWeights.Add(np.random.randn(layerDimensions[currentLayer], layerDimensions[currentLayer - 1]) * .1f); LayerBias.Add(np.zeros(new Shape(layerDimensions[currentLayer], 1))); } }