Skip to content

Commit

Permalink
fix optional input/outputs (#4229)
Browse files Browse the repository at this point in the history
  • Loading branch information
tracysh authored Jun 14, 2020
1 parent 5708c4f commit bf3c321
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions onnxruntime/core/framework/sequential_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void CalculateTotalOutputSizes(OpKernelContextInternal* op_kernel_context
ORT_UNUSED_PARAMETER(node_name);
for (auto i = 0; i < op_kernel_context->OutputCount(); i++) {
const OrtValue* p_output = op_kernel_context->GetOutputMLValue(i);
if (p_output->IsTensor()) {
if (p_output != nullptr && p_output->IsTensor()) {
const auto& tensor = p_output->Get<Tensor>();
size_t tensor_size = tensor.SizeInBytes();
#if defined(TRACE_EXECUTION)
Expand Down Expand Up @@ -89,7 +89,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->IsTensor()) {
if (p_input != nullptr && p_input->IsTensor()) {
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 Expand Up @@ -270,7 +270,7 @@ Status SequentialExecutor::Execute(const SessionState& session_state, const std:

const std::string node_name_for_profiling = [&]() -> std::string {
if (!is_profiler_enabled) return {};
// Derive something meaningful for profile traces and logs if node name field is blank in execution graph
// Derive something meaningful for profile traces and logs if node name field is blank in execution graph
return node.Name().empty() ? MakeString(node.OpType(), "_", node_index) : node.Name();
}();

Expand Down

0 comments on commit bf3c321

Please sign in to comment.