| 47 | TEST_SUITE(MemoryManager) |
| 48 | |
| 49 | TEST_CASE(BlobMemoryManagerSimpleWithinFunctionLevel, framework::DatasetMode::ALL) |
| 50 | { |
| 51 | Allocator allocator{}; |
| 52 | auto lifetime_mgr = std::make_shared<BlobLifetimeManager>(); |
| 53 | auto pool_mgr = std::make_shared<PoolManager>(); |
| 54 | auto mm = std::make_shared<MemoryManagerOnDemand>(lifetime_mgr, pool_mgr); |
| 55 | |
| 56 | // Create tensors |
| 57 | Tensor src = create_tensor<Tensor>(TensorShape(27U, 11U, 3U), DataType::F32, 1); |
| 58 | Tensor dst = create_tensor<Tensor>(TensorShape(27U, 11U, 3U), DataType::F32, 1); |
| 59 | |
| 60 | // Create and configure function |
| 61 | NENormalizationLayer norm_layer_1(mm); |
| 62 | NENormalizationLayer norm_layer_2(mm); |
| 63 | norm_layer_1.configure(&src, &dst, NormalizationLayerInfo(NormType::CROSS_MAP, 3)); |
| 64 | norm_layer_2.configure(&src, &dst, NormalizationLayerInfo(NormType::IN_MAP_1D, 3)); |
| 65 | |
| 66 | ARM_COMPUTE_ASSERT(src.info()->is_resizable()); |
| 67 | ARM_COMPUTE_ASSERT(dst.info()->is_resizable()); |
| 68 | |
| 69 | // Allocate tensors |
| 70 | src.allocator()->allocate(); |
| 71 | dst.allocator()->allocate(); |
| 72 | |
| 73 | ARM_COMPUTE_ASSERT(!src.info()->is_resizable()); |
| 74 | ARM_COMPUTE_ASSERT(!dst.info()->is_resizable()); |
| 75 | |
| 76 | // Finalize memory manager |
| 77 | mm->populate(allocator, 1 /* num_pools */); |
| 78 | ARM_COMPUTE_EXPECT(mm->pool_manager()->num_pools() == 1, framework::LogLevel::ERRORS); |
| 79 | ARM_COMPUTE_EXPECT(mm->lifetime_manager()->are_all_finalized(), framework::LogLevel::ERRORS); |
| 80 | |
| 81 | // Fill tensors |
| 82 | arm_compute::test::library->fill_tensor_uniform(Accessor(src), 0); |
| 83 | |
| 84 | // Compute functions |
| 85 | norm_layer_1.run(); |
| 86 | norm_layer_2.run(); |
| 87 | |
| 88 | // Clear manager |
| 89 | mm->clear(); |
| 90 | ARM_COMPUTE_EXPECT(mm->pool_manager()->num_pools() == 0, framework::LogLevel::ERRORS); |
| 91 | } |
| 92 | |
| 93 | TEST_SUITE_END() |
| 94 | TEST_SUITE_END() |
nothing calls this directly
no test coverage detected