diff options
author | 2017-07-28 08:42:57 -0700 | |
---|---|---|
committer | 2017-07-28 08:47:06 -0700 | |
commit | 123f84b8e0f4df5ecd97b005876f4b1cd1594ce9 (patch) | |
tree | 4bd206749068154a7d84c7879a1f5f58fc6e5464 /tensorflow | |
parent | 94934d94407962f992dfbc22007bbaaadbaf63c2 (diff) |
[TF:XLA] Remove unused XlaBinaryMapOp class.
All the ops that previously used Map do so no longer.
PiperOrigin-RevId: 163473589
Diffstat (limited to 'tensorflow')
-rw-r--r-- | tensorflow/compiler/tf2xla/kernels/cwise_ops.cc | 37 | ||||
-rw-r--r-- | tensorflow/compiler/tf2xla/kernels/cwise_ops.h | 30 |
2 files changed, 0 insertions, 67 deletions
diff --git a/tensorflow/compiler/tf2xla/kernels/cwise_ops.cc b/tensorflow/compiler/tf2xla/kernels/cwise_ops.cc index de93a88f06..0cf03ceb94 100644 --- a/tensorflow/compiler/tf2xla/kernels/cwise_ops.cc +++ b/tensorflow/compiler/tf2xla/kernels/cwise_ops.cc @@ -137,41 +137,4 @@ XlaBinaryOp::Broadcast(xla::ComputationBuilder* builder, return {lhs_output, rhs_output}; } -xla::ComputationDataHandle XlaBinaryMapOp::Computation( - XlaOpKernelContext* ctx, const xla::ComputationDataHandle& lhs, - const gtl::ArraySlice<int64>& lhs_shape, - const xla::ComputationDataHandle& rhs, - const gtl::ArraySlice<int64>& rhs_shape, const BCast& broadcast_helper, - const std::vector<int64>& extend_dimensions) { - xla::ComputationBuilder* builder = ctx->builder(); - - // Construct the builder for the lambda computation. - xla::ComputationBuilder l(builder->client(), ctx->op_kernel().name()); - xla::PrimitiveType type; - TF_CHECK_OK(DataTypeToPrimitiveType(input_type(0), &type)); - - // Make two scalar parameters of the desired type for the lambda. - xla::ComputationDataHandle x = - l.Parameter(0, xla::ShapeUtil::MakeShape(type, {}), "x"); - xla::ComputationDataHandle y = - l.Parameter(1, xla::ShapeUtil::MakeShape(type, {}), "y"); - - // Call virtual method to build the lambda. - BuildMapLambda(&l, x, y); - xla::Computation computation = l.Build().ConsumeValueOrDie(); - - xla::ComputationDataHandle lhs_broadcast = lhs; - xla::ComputationDataHandle rhs_broadcast = rhs; - if (lhs_shape == rhs_shape) { - // There's no broadcasting to do. - CHECK_EQ(0, extend_dimensions.size()); - return builder->Map({lhs, rhs}, computation); - } else { - std::tie(lhs_broadcast, rhs_broadcast) = - Broadcast(builder, lhs, rhs, broadcast_helper); - } - // Now the two sides are broadcast to the final shape we can do the map. - return builder->Map({lhs_broadcast, rhs_broadcast}, computation); -} - } // namespace tensorflow diff --git a/tensorflow/compiler/tf2xla/kernels/cwise_ops.h b/tensorflow/compiler/tf2xla/kernels/cwise_ops.h index ba38693325..5bc1d5fb1f 100644 --- a/tensorflow/compiler/tf2xla/kernels/cwise_ops.h +++ b/tensorflow/compiler/tf2xla/kernels/cwise_ops.h @@ -74,36 +74,6 @@ class XlaBinaryOp : public XlaOpKernel { const BCast& broadcast_helper); }; -// Coefficient-wise binary operations that map a scalar function. Each -// BinaryMap Op expects two inputs that can be broadcast to the same -// shape and maps a (scalar,scalar)->scalar function across the zipped -// elements of its (broadcast) inputs. The base class contains pure -// virtual methods to override: description is a textual description -// of the mapped function; and BuildMapLambda adds the -// implementation of the lambda to a xla::ComputationBuilder. -// Operations may have better performance if implemented as graphs of -// element-wise tensor operations. -class XlaBinaryMapOp : public XlaBinaryOp { - public: - explicit XlaBinaryMapOp(OpKernelConstruction* ctx) : XlaBinaryOp(ctx) {} - ~XlaBinaryMapOp() override {} - - // Implement the (scalar,scalar)->scalar lambda that should be - // applied to each pair of elements of the inputs. The desired - // computation should be added to 'builder' and - // '(scalar_lhs,scalar_rhs)' are the function's inputs. - virtual void BuildMapLambda(xla::ComputationBuilder* builder, - const xla::ComputationDataHandle& scalar_lhs, - const xla::ComputationDataHandle& scalar_rhs) = 0; - - xla::ComputationDataHandle Computation( - XlaOpKernelContext* ctx, const xla::ComputationDataHandle& lhs, - const gtl::ArraySlice<int64>& lhs_shape, - const xla::ComputationDataHandle& rhs, - const gtl::ArraySlice<int64>& rhs_shape, const BCast& broadcast_helper, - const std::vector<int64>& extend_dimensions) override; -}; - } // namespace tensorflow #endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_CWISE_OPS_H_ |