private Sigma1DLayer ConvertLayer(Layer1D layer) { double sigma = 0; var d = layer as IResistivityLayer1D; if (d != null) { sigma = (1 / d.Resistivity); } if (layer is IConductivityLayer1D) { sigma = ((layer as IConductivityLayer1D).Sigma); } return(new Sigma1DLayer(layer.Thickness, sigma)); }
public void CorrectlyPoolToSingle() { // Input: // 0 1 2 // // Filter: // 0,1 1,2 // // Pooling: // max(0,1; 1,2) var input = new Layer1D(3, Array.Empty <Layer>(), ActivationFunctionType.RELU, InitialisationFunctionType.GlorotUniform); var filter = new Filter1D(new[] { input }, 2, ActivationFunctionType.RELU, InitialisationFunctionType.GlorotUniform); filter.AddPooling(2); var node = Assert.Single(filter.Nodes); var pooledNode = Assert.IsType <PooledNode>(node); Assert.Equal(2, pooledNode.UnderlyingNodes.Count); }