From b74a74393b0d4ce118cc051d91f7b5996bf3dd98 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 7 Sep 2016 10:29:53 -0800 Subject: Delegate to C++ shape inference function for some conv and pooling functions. Change several C++ shape inference functions to not return an error if an input dimension is unknown; this more closely matches the python functions. Change: 132459740 --- tensorflow/core/framework/shape_inference.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tensorflow/core/framework/shape_inference.cc') diff --git a/tensorflow/core/framework/shape_inference.cc b/tensorflow/core/framework/shape_inference.cc index 6118bf1288..e3b8767e79 100644 --- a/tensorflow/core/framework/shape_inference.cc +++ b/tensorflow/core/framework/shape_inference.cc @@ -539,7 +539,7 @@ Status InferenceContext::MakeDimForScalarInput(int idx, DimensionHandle* out) { } Status InferenceContext::Divide(DimensionHandle dividend, int64 divisor, - DimensionHandle* out) { + bool evenly_divisible, DimensionHandle* out) { if (divisor == 1) { *out = dividend; } else if (!ValueKnown(dividend)) { @@ -550,9 +550,10 @@ Status InferenceContext::Divide(DimensionHandle dividend, int64 divisor, return errors::InvalidArgument("Divisor must be positive but is ", divisor); } - if ((v % divisor) != 0) { - return errors::InvalidArgument("Dimension size must be divisible by ", - divisor, " but is ", v); + if (evenly_divisible && (v % divisor) != 0) { + return errors::InvalidArgument( + "Dimension size must be evenly divisible by ", divisor, " but is ", + v); } *out = MakeDim(v / divisor); } -- cgit v1.2.3