| 374 | } |
| 375 | |
| 376 | void NEFFTConvolutionLayer::prepare() |
| 377 | { |
| 378 | if (!_is_prepared) |
| 379 | { |
| 380 | // Permute bias to NCHW |
| 381 | if (_original_bias != nullptr) |
| 382 | { |
| 383 | _permuted_bias.allocator()->allocate(); |
| 384 | _permute_bias_func.run(); |
| 385 | _original_bias->mark_as_unused(); |
| 386 | } |
| 387 | |
| 388 | const ITensor *cur_weights = _original_weights; |
| 389 | |
| 390 | // Permute weights |
| 391 | if (_needs_permute) |
| 392 | { |
| 393 | ARM_COMPUTE_ERROR_ON(!cur_weights->is_used()); |
| 394 | |
| 395 | _permuted_weights.allocator()->allocate(); |
| 396 | _permute_weights_func.run(); |
| 397 | cur_weights->mark_as_unused(); |
| 398 | cur_weights = &_permuted_weights; |
| 399 | } |
| 400 | |
| 401 | // Flip weights |
| 402 | _flipped_weights.allocator()->allocate(); |
| 403 | _flip_weights_func.run(); |
| 404 | cur_weights->mark_as_unused(); |
| 405 | |
| 406 | // Pad weights |
| 407 | _padded_weights.allocator()->allocate(); |
| 408 | _pad_weights_func.run(); |
| 409 | _flipped_weights.mark_as_unused(); |
| 410 | _flipped_weights.allocator()->free(); |
| 411 | |
| 412 | // Transform weights to frequency domain |
| 413 | _transformed_weights.allocator()->allocate(); |
| 414 | _transform_weights_func->run(); |
| 415 | _transform_weights_func.reset(); |
| 416 | |
| 417 | _padded_weights.mark_as_unused(); |
| 418 | _padded_weights.allocator()->free(); |
| 419 | |
| 420 | _is_prepared = true; |
| 421 | } |
| 422 | } |
| 423 | } // namespace arm_compute |