コード例 #1
0
  @Test
  public void removesNonexistentLayer() {
    Set<Layer> layers = new HashSet<Layer>();
    Layer topLayer = new Layer();
    Layer middleLayer = new Layer();
    Layer bottomLayer = new Layer();

    layers.add(topLayer);
    layers.add(middleLayer);
    layers.add(bottomLayer);
    network.setLayers(layers);

    assertTrue(network.removeLayer(new Layer()));
  }
コード例 #2
0
  @Test
  public void removesTopAndMiddleLayer() {
    Set<Layer> layers = new HashSet<Layer>();
    Layer topLayer = new Layer();
    Layer middleLayer = new Layer();
    Layer bottomLayer = new Layer();

    Connections firstConnection = new FullyConnected(topLayer, middleLayer, 0, 0);
    Connections secondConnection = new FullyConnected(middleLayer, bottomLayer, 0, 0);

    topLayer.addConnection(firstConnection);
    middleLayer.addConnection(firstConnection);

    middleLayer.addConnection(secondConnection);
    bottomLayer.addConnection(secondConnection);

    layers.add(topLayer);
    layers.add(middleLayer);
    layers.add(bottomLayer);
    network.setLayers(layers);

    assertTrue(network.removeLayer(topLayer));
    assertTrue(network.removeLayer(middleLayer));
  }
コード例 #3
0
 @Test
 public void removeLayerFromNullLayerList() {
   network.setLayers(null);
   assertFalse(network.removeLayer(new Layer()));
 }
コード例 #4
0
 @Test
 public void removeLayerDoesntRemoveNullLayer() {
   assertFalse(network.removeLayer(null));
 }