[Grappler] Fix a stack-use-after-scope
The problem is that Attrs stores a non-owning reference to the temporary intializer list. The lifetime of that list ends at the end of the full expression. This happens to work if TF is compiled with -fmerge-all-constants but doesn't without it. PiperOrigin-RevId: 277567188 Change-Id: Icf88e32127332cd314895524829313f71f99761d
This commit is contained in:
parent
0f1de253ac
commit
235e1ff472
@ -203,15 +203,15 @@ Status CreateSimpleConv2DBackpropFilter(GraphDef* graph,
|
|||||||
ops::RandomUniform(scope.WithOpName("out_backprop"),
|
ops::RandomUniform(scope.WithOpName("out_backprop"),
|
||||||
{kBatchSize, kHeight, kWidth, kDepthOut}, data_type);
|
{kBatchSize, kHeight, kWidth, kDepthOut}, data_type);
|
||||||
if (padding == "EXPLICIT") {
|
if (padding == "EXPLICIT") {
|
||||||
auto attrs = ops::Conv2DBackpropFilter::Attrs()
|
|
||||||
.Dilations({1, kDilation, kDilation, 1})
|
|
||||||
.ExplicitPaddings({0, 0, kPaddingTop, kPaddingBottom,
|
|
||||||
kPaddingLeft, kPaddingRight, 0, 0})
|
|
||||||
.DataFormat(kSrcFormat);
|
|
||||||
auto conv2d_backprop_filter = ops::Conv2DBackpropFilter(
|
auto conv2d_backprop_filter = ops::Conv2DBackpropFilter(
|
||||||
scope.WithOpName("conv2d_backprop_filter").WithDevice("/device:GPU:0"),
|
scope.WithOpName("conv2d_backprop_filter").WithDevice("/device:GPU:0"),
|
||||||
input, {kHeight, kWidth, kDepthIn, kDepthOut}, out_backprop,
|
input, {kHeight, kWidth, kDepthIn, kDepthOut}, out_backprop,
|
||||||
{1, 2, 4, 1}, padding, attrs);
|
{1, 2, 4, 1}, padding,
|
||||||
|
ops::Conv2DBackpropFilter::Attrs()
|
||||||
|
.Dilations({1, kDilation, kDilation, 1})
|
||||||
|
.ExplicitPaddings({0, 0, kPaddingTop, kPaddingBottom, kPaddingLeft,
|
||||||
|
kPaddingRight, 0, 0})
|
||||||
|
.DataFormat(kSrcFormat));
|
||||||
auto output =
|
auto output =
|
||||||
ops::Identity(scope.WithOpName("output"), conv2d_backprop_filter);
|
ops::Identity(scope.WithOpName("output"), conv2d_backprop_filter);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user