代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/tensorflow 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 3f6fe4dfef6f57e768260b48166c27d148f3015f Mon Sep 17 00:00:00 2001
From: Mihai Maruseac <mihaimaruseac@google.com>
Date: Tue, 4 May 2021 18:33:28 -0700
Subject: [PATCH] Add missing validations in dillation ops.
PiperOrigin-RevId: 372037158
Change-Id: I4ee304c84a02550c030288a6534000b934fc1599
---
tensorflow/core/kernels/dilation_ops.cc | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/tensorflow/core/kernels/dilation_ops.cc b/tensorflow/core/kernels/dilation_ops.cc
index 738ea31d555d5..996ddb62bfefe 100644
--- a/tensorflow/core/kernels/dilation_ops.cc
+++ b/tensorflow/core/kernels/dilation_ops.cc
@@ -130,6 +130,7 @@ class DilationOp : public OpKernel {
ParseSizes(context, strides_, rates_, padding_, &stride_rows, &stride_cols,
&rate_rows, &rate_cols, &pad_top, &pad_left, &out_rows,
&out_cols);
+ if (!context->status().ok()) return;
// Output tensor is of the following dimensions:
// [ batch, out_rows, out_cols, depth ]
@@ -229,6 +230,7 @@ class DilationBackpropInputOp : public OpKernel {
ParseSizes(context, strides_, rates_, padding_, &stride_rows, &stride_cols,
&rate_rows, &rate_cols, &pad_top, &pad_left, &out_rows,
&out_cols);
+ if (!context->status().ok()) return;
// Verify that the incoming gradient tensor has the expected size
// [ batch, out_rows, out_cols, depth ]
@@ -318,8 +320,10 @@ struct DilationBackpropInput<CPUDevice, T> {
}
}
}
- in_backprop(b, h_in_max, w_in_max, d) +=
- out_backprop(b, h_out, w_out, d);
+ if (h_in_max < input_rows && w_in_max < input_cols) {
+ in_backprop(b, h_in_max, w_in_max, d) +=
+ out_backprop(b, h_out, w_out, d);
+ }
}
}
}
@@ -349,6 +353,7 @@ class DilationBackpropFilterOp : public OpKernel {
ParseSizes(context, strides_, rates_, padding_, &stride_rows, &stride_cols,
&rate_rows, &rate_cols, &pad_top, &pad_left, &out_rows,
&out_cols);
+ if (!context->status().ok()) return;
// Verify that the incoming gradient tensor has the expected size
// [ batch, out_rows, out_cols, depth ]
@@ -438,8 +443,10 @@ struct DilationBackpropFilter<CPUDevice, T> {
}
}
}
- filter_backprop(h_max, w_max, d) +=
- out_backprop(b, h_out, w_out, d);
+ if (h_max < filter_rows && w_max < filter_cols) {
+ filter_backprop(h_max, w_max, d) +=
+ out_backprop(b, h_out, w_out, d);
+ }
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。