Fix a bug in execution_provider.cc

This commit is contained in:
Changming Sun 2019-02-06 15:19:06 -08:00
parent 657d46fb3c
commit 7c70d9349a
2 changed files with 4 additions and 2 deletions

View file

@ -373,7 +373,8 @@ typedef enum OrtAllocatorType {
} OrtAllocatorType;
/**
memory types for allocator, exec provider specific types should be extended in each provider
* memory types for allocator, exec provider specific types should be extended in each provider
* Whenever this struct is updated, please also update the MakeKey function in onnxruntime/core/framework/execution_provider.cc
*/
typedef enum OrtMemType {
OrtMemTypeCPUInput = -2, // Any CPU memory used by non-CPU execution provider

View file

@ -11,8 +11,9 @@
namespace onnxruntime {
namespace {
//It assumes max(OrtMemType) <= 1, min(OrtMemType) = -2
inline int MakeKey(int id, OrtMemType mem_type) {
return id << 2 | mem_type;
return id << 2 | (mem_type + 2);
}
} // namespace