diff options
author | 2016-09-07 10:29:53 -0800 | |
---|---|---|
committer | 2016-09-07 11:32:57 -0700 | |
commit | b74a74393b0d4ce118cc051d91f7b5996bf3dd98 (patch) | |
tree | 25e1c958bb867e4102dc5c278851c8a1fc84bf00 /tensorflow/core/framework/shape_inference.cc | |
parent | 6963a93283c8a83ba861a7622c6963ab17a85639 (diff) |
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
Diffstat (limited to 'tensorflow/core/framework/shape_inference.cc')
-rw-r--r-- | tensorflow/core/framework/shape_inference.cc | 9 |
1 files changed, 5 insertions, 4 deletions
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); } |