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

Method execute

src/nlr/DeepPolyBilinearElement.cpp:37–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void DeepPolyBilinearElement::execute(
38 const Map<unsigned, DeepPolyElement *> &deepPolyElementsBefore )
39{
40 log( "Executing..." );
41 ASSERT( hasPredecessor() );
42 allocateMemory();
43 getConcreteBounds();
44
45 // Update the symbolic and concrete upper- and lower- bounds
46 // of each neuron
47 for ( unsigned i = 0; i < _size; ++i )
48 {
49 log( Stringf( "Handling Neuron %u_%u...", _layerIndex, i ) );
50 List<NeuronIndex> sources = _layer->getActivationSources( i );
51
52 ASSERT( sources.size() == 2 );
53 double sourceLbs[2];
54 double sourceUbs[2];
55 unsigned counter = 0;
56 for ( const auto &sourceIndex : sources )
57 {
58 DeepPolyElement *predecessor = deepPolyElementsBefore[sourceIndex._layer];
59 double sourceLb = predecessor->getLowerBound( sourceIndex._neuron );
60 sourceLbs[counter] = sourceLb;
61 double sourceUb = predecessor->getUpperBound( sourceIndex._neuron );
62 sourceUbs[counter] = sourceUb;
63
64 if ( counter == 0 )
65 {
66 _indexA.append( sourceIndex );
67 }
68 else
69 {
70 _indexB.append( sourceIndex );
71 }
72
73 ++counter;
74 }
75
76 double lb = FloatUtils::infinity();
77 double ub = FloatUtils::negativeInfinity();
78 List<double> values = { sourceLbs[0] * sourceLbs[1],
79 sourceLbs[0] * sourceUbs[1],
80 sourceUbs[0] * sourceLbs[1],
81 sourceUbs[0] * sourceUbs[1] };
82 for ( const auto &v : values )
83 {
84 if ( v < lb )
85 lb = v;
86 if ( v > ub )
87 ub = v;
88 }
89 _lb[i] = std::max( lb, _lb[i] );
90 _ub[i] = std::min( ub, _ub[i] );
91
92 // Symbolic lower bound:
93 // out >= alpha * x + beta * y + gamma
94 // where alpha = lb_y, beta = lb_x, gamma = -lb_x * lb_y

Callers

nothing calls this directly

Calls 6

StringfClass · 0.85
getActivationSourcesMethod · 0.80
sizeMethod · 0.45
getLowerBoundMethod · 0.45
getUpperBoundMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected