| 1462 | } |
| 1463 | |
| 1464 | void NEQLSTMLayer::prepare() |
| 1465 | { |
| 1466 | if (!_is_prepared) |
| 1467 | { |
| 1468 | if (_convert_input_to_forget_weights_to_qsymm8) |
| 1469 | { |
| 1470 | _input_to_forget_weights_f32.allocator()->allocate(); |
| 1471 | _input_to_forget_weights_symm8.allocator()->allocate(); |
| 1472 | _dequantize_input_to_forget_weights.run(); |
| 1473 | _quantize_input_to_forget_weights.run(); |
| 1474 | } |
| 1475 | |
| 1476 | // Pre-transpose weights to be used in GEMM. |
| 1477 | _input_to_forget_weights_transposed.allocator()->allocate(); |
| 1478 | _input_to_cell_weights_transposed.allocator()->allocate(); |
| 1479 | _input_to_output_weights_transposed.allocator()->allocate(); |
| 1480 | _recurrent_to_forget_weights_transposed.allocator()->allocate(); |
| 1481 | _recurrent_to_cell_weights_transposed.allocator()->allocate(); |
| 1482 | _recurrent_to_output_weights_transposed.allocator()->allocate(); |
| 1483 | _transpose_input_to_forget_weights.run(); |
| 1484 | _transpose_input_to_cell_weights.run(); |
| 1485 | _transpose_input_to_output_weights.run(); |
| 1486 | _transpose_recurrent_to_forget_weights.run(); |
| 1487 | _transpose_recurrent_to_cell_weights.run(); |
| 1488 | _transpose_recurrent_to_output_weights.run(); |
| 1489 | |
| 1490 | // Precompute effective biases |
| 1491 | if (_has_cifg) |
| 1492 | { |
| 1493 | std::fill_n(reinterpret_cast<int16_t *>(_ones.buffer()), |
| 1494 | _ones.info()->total_size() / _ones.info()->element_size(), 32767); |
| 1495 | } |
| 1496 | else |
| 1497 | { |
| 1498 | _input_to_input_eff_bias.allocator()->allocate(); |
| 1499 | _recurrent_to_input_eff_bias.allocator()->allocate(); |
| 1500 | |
| 1501 | ITensorPack packII = {{TensorType::ACL_SRC, _input_to_input_weights}, |
| 1502 | {TensorType::ACL_DST, &_input_to_input_eff_bias}}; |
| 1503 | NEScheduler::get().schedule_op(_input_to_input_reduction.get(), Window::DimY, |
| 1504 | _input_to_input_reduction->window(), packII); |
| 1505 | |
| 1506 | ITensorPack packRI = {{TensorType::ACL_SRC, _recurrent_to_input_weights}, |
| 1507 | {TensorType::ACL_DST, &_recurrent_to_input_eff_bias}}; |
| 1508 | NEScheduler::get().schedule_op(_recurrent_to_input_reduction.get(), Window::DimY, |
| 1509 | _recurrent_to_input_reduction->window(), packRI); |
| 1510 | |
| 1511 | _input_to_input_weights_transposed.allocator()->allocate(); |
| 1512 | _recurrent_to_input_weights_transposed.allocator()->allocate(); |
| 1513 | _transpose_input_to_input_weights.run(); |
| 1514 | _transpose_recurrent_to_input_weights.run(); |
| 1515 | _input_to_input_weights->mark_as_unused(); |
| 1516 | _recurrent_to_input_weights->mark_as_unused(); |
| 1517 | } |
| 1518 | _input_to_forget_eff_bias.allocator()->allocate(); |
| 1519 | _recurrent_to_forget_eff_bias.allocator()->allocate(); |
| 1520 | _input_to_cell_eff_bias.allocator()->allocate(); |
| 1521 | _recurrent_to_cell_eff_bias.allocator()->allocate(); |
nothing calls this directly
no test coverage detected