MCPcopy Create free account
hub / github.com/NeuralNetworkVerification/Marabou / reduceIndexFromAllMaps

Method reduceIndexFromAllMaps

src/nlr/Layer.cpp:2047–2069  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2045}
2046
2047void Layer::reduceIndexFromAllMaps( unsigned startIndex )
2048{
2049 // Adjust the source layers
2050 Map<unsigned, unsigned> copyOfSources = _sourceLayers;
2051 _sourceLayers.clear();
2052 for ( const auto &pair : copyOfSources )
2053 _sourceLayers[pair.first >= startIndex ? pair.first - 1 : pair.first] = pair.second;
2054
2055 // Adjust all weight maps
2056 adjustWeightMapIndexing( _layerToWeights, startIndex );
2057 adjustWeightMapIndexing( _layerToPositiveWeights, startIndex );
2058 adjustWeightMapIndexing( _layerToNegativeWeights, startIndex );
2059
2060 // Adjust the neuron activations
2061 for ( auto &neuronToSources : _neuronToActivationSources )
2062 {
2063 for ( auto &source : neuronToSources.second )
2064 {
2065 if ( source._layer >= startIndex )
2066 --source._layer;
2067 }
2068 }
2069}
2070
2071void Layer::adjustWeightMapIndexing( Map<unsigned, double *> &map, unsigned startIndex )
2072{

Callers 1

reduceLayerIndexMethod · 0.80

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected