Return if an error status was set in LinearAlgebraOp::AnalyzeInput() or LinearAlgebraOp::PrepareOutputs(), instead of potentially crashing.

PiperOrigin-RevId: 279834647
Change-Id: Iaef1b3598eaee212c75e397f4ffafce0ebfdf8b8
This commit is contained in:
A. Unique TensorFlower 2019-11-11 15:47:31 -08:00 committed by TensorFlower Gardener
parent 4a0ba5e5b1
commit a895bdaf05

View File

@ -92,11 +92,13 @@ void LinearAlgebraOp<InputScalar, OutputScalar>::Compute(
TensorShapes input_matrix_shapes;
TensorShape batch_shape;
AnalyzeInputs(context, &inputs, &input_matrix_shapes, &batch_shape);
if (!context->status().ok()) return;
TensorShapes output_matrix_shapes;
TensorOutputs outputs;
PrepareOutputs(context, input_matrix_shapes, batch_shape, &outputs,
&output_matrix_shapes);
if (!context->status().ok()) return;
// Process the individual matrix problems in parallel using a threadpool.
auto shard = [this, &inputs, &input_matrix_shapes, &outputs,