From 91096781c34a5278c496bbd94fd0da4445a3e005 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Tue, 14 Dec 2021 21:21:07 -0800 Subject: [PATCH] A small fix to allocators (#10042) --- onnxruntime/core/framework/session_state_utils.cc | 2 +- onnxruntime/core/framework/tensor.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/framework/session_state_utils.cc b/onnxruntime/core/framework/session_state_utils.cc index bf35b82beb..3791919438 100644 --- a/onnxruntime/core/framework/session_state_utils.cc +++ b/onnxruntime/core/framework/session_state_utils.cc @@ -44,7 +44,7 @@ static common::Status AllocateBufferUsingDeviceAllocatorFromShapeAndType(const T if (shape_size > 0) { SafeInt mem_size = 0; - if (!alloc->CalcMemSizeForArray(SafeInt(shape_size), type->Size(), &mem_size)) { + if (!IAllocator::CalcMemSizeForArray(SafeInt(shape_size), type->Size(), &mem_size)) { return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "Failed memory size calculation"); } diff --git a/onnxruntime/core/framework/tensor.cc b/onnxruntime/core/framework/tensor.cc index 01ca218ba8..81c9db9163 100644 --- a/onnxruntime/core/framework/tensor.cc +++ b/onnxruntime/core/framework/tensor.cc @@ -29,7 +29,7 @@ Tensor::Tensor(MLDataType p_type, const TensorShape& shape, std::shared_ptr 0) { SafeInt len = 0; - if (!allocator->CalcMemSizeForArray(SafeInt(shape_size), p_type->Size(), &len)) + if (!IAllocator::CalcMemSizeForArray(SafeInt(shape_size), p_type->Size(), &len)) ORT_THROW("tensor failed memory size calculation"); p_data = allocator->Alloc(len);