diff --git a/onnxruntime/core/providers/cpu/tensor/gather.cc b/onnxruntime/core/providers/cpu/tensor/gather.cc index 5f31fa57ad..7ed3cf2f22 100644 --- a/onnxruntime/core/providers/cpu/tensor/gather.cc +++ b/onnxruntime/core/providers/cpu/tensor/gather.cc @@ -148,12 +148,12 @@ Status Gather::Compute(OpKernelContext* context) const { concurrency::ThreadPool* tp = context->GetOperatorThreadPool(); - if (utils::HasTypeWithSameSize() && + if (utils::HasType() && p.indices_tensor->IsDataType()) { return GatherCopyData(p.indices_tensor, src_base, dst_base, is_string_type, element_bytes, block_size, M, N, data_batch_bytes, gathered_batch_bytes, input_data_shape, p.axis, tp); } - if (utils::HasTypeWithSameSize() && + if (utils::HasType() && p.indices_tensor->IsDataType()) { return GatherCopyData(p.indices_tensor, src_base, dst_base, is_string_type, element_bytes, block_size, M, N, data_batch_bytes, gathered_batch_bytes, input_data_shape, p.axis, tp); diff --git a/onnxruntime/core/providers/cpu/tensor/pad.cc b/onnxruntime/core/providers/cpu/tensor/pad.cc index 2cd3830831..0438783307 100644 --- a/onnxruntime/core/providers/cpu/tensor/pad.cc +++ b/onnxruntime/core/providers/cpu/tensor/pad.cc @@ -244,7 +244,7 @@ static Status PadImpl(OpKernelContext* ctx, const std::vector& slices, const Mode& mode, T value) { - if (!utils::HasType()) { + if (!utils::HasTypeWithSameSize()) { return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "Input data type not supported in this build."); } @@ -517,22 +517,15 @@ Status Pad::Compute(OpKernelContext* ctx) const { slices_to_use = &slices_; } - Status pad_status{}; switch (element_size) { case sizeof(uint32_t): - pad_status = PadImpl(ctx, *pads_to_use, *slices_to_use, mode_, value.u32); - break; + return PadImpl(ctx, *pads_to_use, *slices_to_use, mode_, value.u32); case sizeof(uint64_t): - pad_status = PadImpl(ctx, *pads_to_use, *slices_to_use, mode_, value.u64); - break; + return PadImpl(ctx, *pads_to_use, *slices_to_use, mode_, value.u64); case sizeof(uint8_t): - pad_status = PadImpl(ctx, *pads_to_use, *slices_to_use, mode_, value.u8); - break; + return PadImpl(ctx, *pads_to_use, *slices_to_use, mode_, value.u8); default: - pad_status = ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "Unsupported input data type of ", data_type); - break; + return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "Unsupported input data type of ", data_type); } - - return pad_status; } }; // namespace onnxruntime