public EuclideanLossLayerTests() { var filler = new GaussianFiller(); blobBottomData = new Tensor(10, 5, 1, 1); filler.Fill(blobBottomData); bottom.Add(blobBottomData); blobBottomLabel = new Tensor(10, 5, 1, 1); filler.Fill(blobBottomLabel); bottom.Add(blobBottomLabel); }
public EuclideanLossLayerTests() { var filler = new GaussianFiller(); blobBottomData = new Tensor(10, 5, 1, 1); filler.Fill(blobBottomData); bottom.Add(blobBottomData); blobBottomLabel = new Tensor(10, 5, 1, 1); filler.Fill(blobBottomLabel); bottom.Add(blobBottomLabel); }
public void Filler_GaussianDense(double meanParam, double stdParam) { var blob = new Tensor(2, 3, 4, 5); var config = new GaussianFillerConfiguration(meanParam, stdParam); var filler = new GaussianFiller(config); filler.Fill(blob); double mean = 0; double var = 0; int count = blob.Count; using (var blobCpu = blob.OnCpu()) { for (int i = 0; i < count; i++) { mean += blobCpu.DataAt(i); var += (blobCpu.DataAt(i) - config.Mean) * (blobCpu.DataAt(i) - config.Mean); } mean /= count; var /= count; Assert.True(mean >= config.Mean - config.Std * 5); Assert.True(mean <= config.Mean + config.Std * 5); double targetVar = config.Std * config.Std; Assert.True(var >= (targetVar / 5.0d)); Assert.True(var <= (targetVar * 5.0d)); } }
public void Filler_GaussianDense(double meanParam, double stdParam) { var blob = new Tensor(2, 3, 4, 5); var config = new GaussianFillerConfiguration(meanParam, stdParam); var filler = new GaussianFiller(config); filler.Fill(blob); double mean = 0; double var = 0; int count = blob.Count; using (var blobCpu = blob.OnCpu()) { for (int i = 0; i < count; i++) { mean += blobCpu.DataAt(i); var += (blobCpu.DataAt(i) - config.Mean) * (blobCpu.DataAt(i) - config.Mean); } mean /= count; var /= count; Assert.True(mean >= config.Mean - config.Std * 5); Assert.True(mean <= config.Mean + config.Std * 5); double targetVar = config.Std * config.Std; Assert.True(var >= (targetVar / 5.0d)); Assert.True(var <= (targetVar * 5.0d)); } }
public SoftmaxLossLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); Random rnd = new Random(1000); using (var labelsCpu = labels.OnCpu()) { var labelData = labelsCpu.Data; for (int i = 0; i < labelData.Count; i++) labelData[i] = rnd.Next(5); } }
public SoftmaxLossLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); Random rnd = new Random(1000); using (var labelsCpu = labels.OnCpu()) { var labelData = labelsCpu.Data; for (int i = 0; i < labelData.Count; i++) { labelData[i] = rnd.Next(5); } } }
public void Filler_GaussianSparse(double meanParam, double stdParam) { var blob = new Tensor(2, 3, 4, 5); var config = new GaussianFillerConfiguration(meanParam, stdParam) { IsSparse = true }; var filler = new GaussianFiller(config); filler.Fill(blob); double mean = 0; double var = 0; using (var blobCpu = blob.OnCpu()) { int count = blob.Count; int zeroes = 0; for (int i = 0; i < count; i++) { if (blobCpu.DataAt(i) == 0.0d) { zeroes++; } else { mean += blobCpu.DataAt(i); var += (blobCpu.DataAt(i) - config.Mean) * (blobCpu.DataAt(i) - config.Mean); } } mean /= (count - zeroes); var /= (count - zeroes); Assert.True(mean >= config.Mean - config.Std * 5); Assert.True(mean <= config.Mean + config.Std * 5); double targetVar = config.Std * config.Std; Assert.True(var >= (targetVar / 5.0d)); Assert.True(var <= (targetVar * 5.0d)); } }
public MaxPoolingLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public BnllLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public SoftmaxLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public AveragePoolingLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public SigmoidLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public DropoutLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public ThresholdLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public void Filler_GaussianSparse(double meanParam, double stdParam) { var blob = new Tensor(2, 3, 4, 5); var config = new GaussianFillerConfiguration(meanParam, stdParam) { IsSparse = true }; var filler = new GaussianFiller(config); filler.Fill(blob); double mean = 0; double var = 0; using (var blobCpu = blob.OnCpu()) { int count = blob.Count; int zeroes = 0; for (int i = 0; i < count; i++) { if (blobCpu.DataAt(i) == 0.0d) { zeroes++; } else { mean += blobCpu.DataAt(i); var += (blobCpu.DataAt(i) - config.Mean) * (blobCpu.DataAt(i) - config.Mean); } } mean /= (count - zeroes); var /= (count - zeroes); Assert.True(mean >= config.Mean - config.Std * 5); Assert.True(mean <= config.Mean + config.Std * 5); double targetVar = config.Std * config.Std; Assert.True(var >= (targetVar / 5.0d)); Assert.True(var <= (targetVar * 5.0d)); } }
public SoftmaxLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public DropoutLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public ThresholdLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public TanhLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }
public SigmoidLayerTests() { var filler = new GaussianFiller(); filler.Fill(bottom); }