Skip to content

Commit

Permalink
fix profiling with optional tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
f-salvetti committed Jan 25, 2024
1 parent 2b87dd3 commit dff1043
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions onnxruntime/core/framework/sequential_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static void CalculateTotalOutputSizes(OpKernelContextInternal* op_kernel_context
int output_count = op_kernel_context->OutputCount();
for (auto i = 0; i < output_count; i++) {
const OrtValue* p_output = op_kernel_context->GetOutputMLValue(i);
if (p_output != nullptr && p_output->IsTensor()) {
if (p_output != nullptr && p_output->IsTensor() && p_input->IsAllocated()) {
const auto& tensor = p_output->Get<Tensor>();
size_t tensor_size = tensor.SizeInBytes();
#if defined(TRACE_EXECUTION)
Expand Down Expand Up @@ -104,7 +104,7 @@ static void CalculateTotalInputSizes(const OpKernelContextInternal* op_kernel_co
const int input_count = op_kernel_context->InputCount();
for (auto i = 0; i < input_count; i++) {
const OrtValue* p_input = op_kernel_context->GetInputMLValue(i);
if (p_input != nullptr && p_input->IsTensor()) {
if (p_input != nullptr && p_input->IsTensor() && p_input->IsAllocated()) {
const OpKernelInfo& op_kernel_info = p_op_kernel->Info();
const Tensor* p_tensor = nullptr;
bool is_param = op_kernel_info.TryGetConstantInput(i, &p_tensor);
Expand Down

0 comments on commit dff1043

Please sign in to comment.