aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/framework/shape_inference_testutil.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-08-04 15:15:57 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-08-04 16:31:16 -0700
commitee9241825d80bf295963ac2fad4dfa0fc9a7b998 (patch)
tree81260bea9c5328bd7c12fc4729c646e332115fb6 /tensorflow/core/framework/shape_inference_testutil.cc
parent21038467d71be31193715f7b023e252c0c5e2b05 (diff)
Add C++ shape inference for SVD.
This also adds Min(), Max(), and Subtract() operators and a few convenience methods to the InferenceContext. Change test utils to emit a human readable error message in case the user forgot to set the inference function. Refactored shape_inference* a bit to enforce the invariant that a Dimension or DimensionOrConstant is always non-negative or equal to InferenceContext::kUnknownDim. This made it possible to tighten & simplify the arithmetic operations a bit. Change: 129385995
Diffstat (limited to 'tensorflow/core/framework/shape_inference_testutil.cc')
-rw-r--r--tensorflow/core/framework/shape_inference_testutil.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/core/framework/shape_inference_testutil.cc b/tensorflow/core/framework/shape_inference_testutil.cc
index c1e55d032d..60a9cb101f 100644
--- a/tensorflow/core/framework/shape_inference_testutil.cc
+++ b/tensorflow/core/framework/shape_inference_testutil.cc
@@ -40,6 +40,11 @@ Status InferShapes(ShapeInferenceTestOp op, const string& ins,
shape_inference::InferenceContext c(&op.node_def, op_reg_data->op_def, ins_v,
op.input_tensors);
TF_RETURN_IF_ERROR(c.construction_status());
+ if (op_reg_data->shape_inference_fn == nullptr) {
+ return errors::InvalidArgument(
+ "No shape inference function exists for op '", op.name,
+ "', did you forget to define it?");
+ }
TF_RETURN_IF_ERROR(op_reg_data->shape_inference_fn(&c));
const int num_outputs = c.num_outputs();