代码拉取完成,页面将自动刷新
同步操作将从 openEuler-RISC-V/tensorflow 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 953f28dca13c92839ba389c055587cfe6c723578 Mon Sep 17 00:00:00 2001
From: Mihai Maruseac <mihaimaruseac@google.com>
Date: Tue, 27 Apr 2021 17:46:38 -0700
Subject: [PATCH] Prevent a null pointer exception in TFLite
PiperOrigin-RevId: 370800206
Change-Id: Idd437ebce4ff224120d8eefc1c14c062173b71d6
---
tensorflow/lite/kernels/maximum_minimum.cc | 60 +++++++++++-----------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/tensorflow/lite/kernels/maximum_minimum.cc b/tensorflow/lite/kernels/maximum_minimum.cc
index 777e51442f120..176e020a5a8e5 100644
--- a/tensorflow/lite/kernels/maximum_minimum.cc
+++ b/tensorflow/lite/kernels/maximum_minimum.cc
@@ -157,35 +157,37 @@ template <KernelType kernel_type, typename OpType>
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
OpContext op_context(context, node);
- switch (op_context.output->type) {
- case kTfLiteFloat32:
- TFLiteOperation<kernel_type, float, OpType>(context, node, op_context);
- break;
- case kTfLiteUInt8:
- TFLiteOperation<kernel_type, uint8_t, OpType>(context, node,
- op_context);
- break;
- case kTfLiteInt8:
- TFLiteOperation<kernel_type, int8_t, OpType>(context, node, op_context);
- break;
- case kTfLiteInt32:
- TFLiteOperation<kernel_type, int32_t, OpType>(context, node,
- op_context);
- break;
- case kTfLiteInt64:
- TFLiteOperation<kernel_type, int64_t, OpType>(context, node,
- op_context);
- break;
- case kTfLiteInt16:
- TFLiteOperation<kernel_type, int16_t, OpType>(context, node,
- op_context);
- break;
- default:
- context->ReportError(context,
- "Type %d is currently not supported by Maximum.",
- op_context.output->type);
- return kTfLiteError;
- }
+ // If inputs have no element, shortcircuit.
+ if (NumElements(op_context.input1) == 0 ||
+ NumElements(op_context.input2) == 0) {
+ return kTfLiteOk;
+ }
+
+ switch (op_context.output->type) {
+ case kTfLiteFloat32:
+ TFLiteOperation<kernel_type, float, OpType>(context, node, op_context);
+ break;
+ case kTfLiteUInt8:
+ TFLiteOperation<kernel_type, uint8_t, OpType>(context, node, op_context);
+ break;
+ case kTfLiteInt8:
+ TFLiteOperation<kernel_type, int8_t, OpType>(context, node, op_context);
+ break;
+ case kTfLiteInt32:
+ TFLiteOperation<kernel_type, int32_t, OpType>(context, node, op_context);
+ break;
+ case kTfLiteInt64:
+ TFLiteOperation<kernel_type, int64_t, OpType>(context, node, op_context);
+ break;
+ case kTfLiteInt16:
+ TFLiteOperation<kernel_type, int16_t, OpType>(context, node, op_context);
+ break;
+ default:
+ context->ReportError(context,
+ "Type %d is currently not supported by Maximum.",
+ op_context.output->type);
+ return kTfLiteError;
+ }
return kTfLiteOk;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。