aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/shape_inference.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-03-26 15:19:29 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-26 15:21:46 -0700
commit3a00d79b16348f0a53379e81b8e98bdd93d4833e (patch)
tree183ba5665d19736a280abcd2906befa44d64b24a /tensorflow/compiler/xla/service/shape_inference.cc
parent2c548819707bdafc8057cdd9c997f2a7b420d577 (diff)
[XLA] Redesign: implement and test unary and binary ops.
Also, - Templatized ComputeAndCompareRX and CreateRXParameter so that they accept XlaBuilder and XlaOp. - Clear data held by an XlaBuilder when Build() is called, otherwise errors will occur when the builder is reused. PiperOrigin-RevId: 190534245
Diffstat (limited to 'tensorflow/compiler/xla/service/shape_inference.cc')
-rw-r--r--tensorflow/compiler/xla/service/shape_inference.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/tensorflow/compiler/xla/service/shape_inference.cc b/tensorflow/compiler/xla/service/shape_inference.cc
index 8c8bd6d73a..2a70ea0354 100644
--- a/tensorflow/compiler/xla/service/shape_inference.cc
+++ b/tensorflow/compiler/xla/service/shape_inference.cc
@@ -304,12 +304,17 @@ StatusOr<Shape> InferWindowOutputShape(const Shape& base_shape,
/* static */ StatusOr<Shape> ShapeInference::InferUnaryOpShape(
HloOpcode opcode, const HloInstruction* operand) {
+ return InferUnaryOpShape(opcode, operand->shape());
+}
+
+/* static */ StatusOr<Shape> ShapeInference::InferUnaryOpShape(
+ HloOpcode opcode, const Shape& shape) {
// There is no copy operation at the proto level, so handle copy explicitly.
if (opcode == HloOpcode::kCopy) {
- return operand->shape();
+ return shape;
}
- return InferUnaryOpShape(OpcodeToUnaryOperation(opcode), operand->shape());
+ return InferUnaryOpShape(OpcodeToUnaryOperation(opcode), shape);
}
/* static */ StatusOr<Shape> ShapeInference::InferUnaryOpShape(