A small fix to allocators (#10042)

This commit is contained in:
Changming Sun 2021-12-14 21:21:07 -08:00 committed by GitHub
parent 9d9ebd3b85
commit 91096781c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -44,7 +44,7 @@ static common::Status AllocateBufferUsingDeviceAllocatorFromShapeAndType(const T
if (shape_size > 0) {
SafeInt<size_t> mem_size = 0;
if (!alloc->CalcMemSizeForArray(SafeInt<size_t>(shape_size), type->Size(), &mem_size)) {
if (!IAllocator::CalcMemSizeForArray(SafeInt<size_t>(shape_size), type->Size(), &mem_size)) {
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "Failed memory size calculation");
}

View file

@ -29,7 +29,7 @@ Tensor::Tensor(MLDataType p_type, const TensorShape& shape, std::shared_ptr<IAll
void* p_data = nullptr;
if (shape_size > 0) {
SafeInt<size_t> len = 0;
if (!allocator->CalcMemSizeForArray(SafeInt<size_t>(shape_size), p_type->Size(), &len))
if (!IAllocator::CalcMemSizeForArray(SafeInt<size_t>(shape_size), p_type->Size(), &len))
ORT_THROW("tensor failed memory size calculation");
p_data = allocator->Alloc(len);