onnxruntime/onnxruntime/test/framework/TestAllocatorManager.h
Ryan Hill 11b369a864
Abbreviate ONNXRuntime as Ort in all of our public APIs (#175)
Applies to all public headers and macros, plus many internal ones. There are still some internal things with OnnxRuntime in the name, but this fixes all public functions & macros.
2018-12-14 14:54:23 -08:00

30 lines
847 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "core/framework/arena.h"
namespace onnxruntime {
namespace test {
class AllocatorManager {
public:
// the allocator manager is a just for onnx runner to allocate space for input/output tensors.
// onnxruntime session will use the allocator owned by execution provider.
static AllocatorManager& Instance();
/**
Destruct th AllocatorManager. Will unset Instance().
*/
~AllocatorManager();
AllocatorPtr GetAllocator(const std::string& name, const int id = 0, bool arena = true);
private:
ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(AllocatorManager);
AllocatorManager();
Status InitializeAllocators();
std::unordered_map<std::string, AllocatorPtr> map_;
};
} // namespace test
} // namespace onnxruntime