mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
A small fix to allocators (#10042)
This commit is contained in:
parent
9d9ebd3b85
commit
91096781c3
2 changed files with 2 additions and 2 deletions
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue