Update tensorflow/core/ops/image_ops.cc

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2018-03-13 17:57:25 +00:00
parent d8064519ee
commit 2c409af18d

View File

@ -606,6 +606,7 @@ REGISTER_OP("ExtractGlimpse")
.Attr("centered: bool = true")
.Attr("normalized: bool = true")
.Attr("uniform_noise: bool = true")
.Attr("noise: string = ''")
.SetShapeFn([](InferenceContext* c) {
ShapeHandle input;
TF_RETURN_IF_ERROR(c->WithRank(c->input(0), 4, &input));
@ -618,6 +619,14 @@ REGISTER_OP("ExtractGlimpse")
DimensionHandle unused;
TF_RETURN_IF_ERROR(c->WithValue(c->Dim(offsets, 1), 2, &unused));
bool uniform_noise = false;
TF_RETURN_IF_ERROR(c->GetAttr("uniform_noise", &uniform_noise));
string noise;
TF_RETURN_IF_ERROR(c->GetAttr("noise", &noise));
if (uniform_noise && noise != "") {
return errors::InvalidArgument("The uniform_noise and noise could not be specified at the same time");
}
return SetOutputToSizedImage(c, batch_dim, 1 /* size_input_idx */,
c->Dim(input, 3));
});