MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / prepare

Method prepare

src/runtime/CL/functions/CLFullyConnectedLayer.cpp:131–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void CLFullyConnectedLayer::prepare()
132{
133 if (!_impl->is_prepared)
134 {
135 allocate_tensors(_impl->aux_mem_req, _impl->workspace);
136 if (!_impl->dynamic_weights)
137 {
138 _impl->op->prepare(_impl->run_pack);
139
140 // Release temporary tensors that are only used in prepare stage
141 release_temporaries<CLTensor>(_impl->aux_mem_req, _impl->workspace);
142
143 // Handle weights managed infrastructure
144 if (_impl->weights_manager != nullptr &&
145 _impl->weights_manager->are_weights_managed(_impl->original_weights))
146 {
147 // Ensure that b gets marked as unused (memory released) only after the last function which uses b also finishes its prepare
148 // This is for cases where multiple functions share the same b (weights)
149 // Therefore when a function marks original b as unused, we pre-mark it in weights manager, and mark it back to used so that it doesn't get released before its last reference
150 const ITensor *original_b = _impl->original_weights;
151 if (!original_b->is_used())
152 {
153 _impl->weights_manager->pre_mark_as_unused(original_b);
154 }
155 _impl->original_weights->mark_as_used();
156 _impl->weights_manager->release(_impl->original_weights);
157 }
158 }
159 _impl->is_prepared = true;
160 }
161}
162} // namespace arm_compute

Callers

nothing calls this directly

Calls 6

allocate_tensorsFunction · 0.85
are_weights_managedMethod · 0.80
is_usedMethod · 0.80
pre_mark_as_unusedMethod · 0.80
mark_as_usedMethod · 0.80
releaseMethod · 0.45

Tested by

no test coverage detected