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

Method prepare

src/runtime/CL/functions/CLQLSTMLayer.cpp:1343–1452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1341}
1342
1343void CLQLSTMLayer::prepare()
1344{
1345 if (!_is_prepared)
1346 {
1347 // Pre-transpose weights to be used in GEMM.
1348 _input_to_forget_weights_transposed.allocator()->allocate();
1349 _input_to_cell_weights_transposed.allocator()->allocate();
1350 _input_to_output_weights_transposed.allocator()->allocate();
1351 _recurrent_to_forget_weights_transposed.allocator()->allocate();
1352 _recurrent_to_cell_weights_transposed.allocator()->allocate();
1353 _recurrent_to_output_weights_transposed.allocator()->allocate();
1354 _transpose_input_to_forget_weights.run();
1355 _transpose_input_to_cell_weights.run();
1356 _transpose_input_to_output_weights.run();
1357 _transpose_recurrent_to_forget_weights.run();
1358 _transpose_recurrent_to_cell_weights.run();
1359 _transpose_recurrent_to_output_weights.run();
1360
1361 // Precompute effective biases
1362 if (_has_cifg)
1363 {
1364 _ones.map(true);
1365 std::fill_n(reinterpret_cast<int16_t *>(_ones.buffer()),
1366 _ones.info()->total_size() / _ones.info()->element_size(), 32767);
1367 _ones.unmap();
1368 }
1369 else
1370 {
1371 _input_to_input_eff_bias.allocator()->allocate();
1372 _recurrent_to_input_eff_bias.allocator()->allocate();
1373
1374 ITensorPack input_to_input_red_pack = {{ACL_SRC, _input_to_input_weights},
1375 {ACL_DST, &_input_to_input_eff_bias}};
1376 CLScheduler::get().enqueue_op(*_input_to_input_reduction, input_to_input_red_pack, false);
1377
1378 ITensorPack rec_to_input_red_pack = {{ACL_SRC, _recurrent_to_input_weights},
1379 {ACL_DST, &_recurrent_to_input_eff_bias}};
1380 CLScheduler::get().enqueue_op(*_recurrent_to_input_reduction, rec_to_input_red_pack, false);
1381
1382 _input_to_input_weights_transposed.allocator()->allocate();
1383 _recurrent_to_input_weights_transposed.allocator()->allocate();
1384 _transpose_input_to_input_weights.run();
1385 _transpose_recurrent_to_input_weights.run();
1386 _input_to_input_weights->mark_as_unused();
1387 _recurrent_to_input_weights->mark_as_unused();
1388 }
1389 _input_to_forget_eff_bias.allocator()->allocate();
1390 _recurrent_to_forget_eff_bias.allocator()->allocate();
1391 _input_to_cell_eff_bias.allocator()->allocate();
1392 _recurrent_to_cell_eff_bias.allocator()->allocate();
1393 _input_to_output_eff_bias.allocator()->allocate();
1394 _recurrent_to_output_eff_bias.allocator()->allocate();
1395
1396 ITensorPack input_to_forget_red_pack = {{ACL_SRC, _input_to_forget_weights},
1397 {ACL_DST, &_input_to_forget_eff_bias}};
1398 CLScheduler::get().enqueue_op(*_input_to_forget_reduction, input_to_forget_red_pack, false);
1399
1400 ITensorPack rec_to_forget_red_pack = {{ACL_SRC, _recurrent_to_forget_weights},

Callers

nothing calls this directly

Calls 12

enqueue_opMethod · 0.80
mark_as_unusedMethod · 0.80
allocateMethod · 0.45
allocatorMethod · 0.45
runMethod · 0.45
mapMethod · 0.45
bufferMethod · 0.45
total_sizeMethod · 0.45
infoMethod · 0.45
element_sizeMethod · 0.45
unmapMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected