onnxruntime/onnxruntime/core/session/allocator_impl.h
Pranav Sharma 52fe574fed
Rename OrtAllocatorInfo to OrtMemoryInfo to make it more obvious. (#1758)
* Mention OrtCreateSessionFromArray in C API doc

* Rename OrtAllocatorInfo to OrtMemoryInfo to avoid confusion
2019-09-05 14:20:37 -07:00

25 lines
625 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "core/session/onnxruntime_c_api.h"
#include "core/framework/allocator.h"
namespace onnxruntime {
class AllocatorWrapper : public IAllocator {
public:
AllocatorWrapper(OrtAllocator* impl) : impl_(impl) {}
void* Alloc(size_t size) override {
return impl_->Alloc(impl_, size);
}
void Free(void* p) override {
return impl_->Free(impl_, p);
}
const OrtMemoryInfo& Info() const override {
return *impl_->Info(impl_);
}
private:
OrtAllocator* impl_;
};
} // namespace onnxruntime