diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-06-19 16:02:35 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-19 16:10:06 -0700 |
commit | a455319208888e72af34fc3021122803a53a047d (patch) | |
tree | 33689d0f3b8c475212487d3efeb999418ea56a83 /tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc | |
parent | 5bc928f1f52e512a53f9e3297f6421cd9462dfc3 (diff) |
Automated g4 rollback of changelist 201217989
PiperOrigin-RevId: 201257755
Diffstat (limited to 'tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc')
-rw-r--r-- | tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc index d49c087071..90be051764 100644 --- a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc +++ b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc @@ -2519,14 +2519,14 @@ class ConvertLog1pStage : public ArithmeticOptimizerStage { bool* modified) { const auto& t = ctx().graph_properties->GetInputProperties(input->name())[i]; - const auto& c = - ctx().graph_properties->GetInputProperties(input->name())[j]; - for (int k = 0; k < c.shape().dim_size(); ++k) { - // Skip if c shape is not fully determined. - if (c.shape().dim(k).size() < 0) { + for (int k = 0; k < t.shape().dim_size(); ++k) { + // Skip if t shape is not fully determined. + if (t.shape().dim(k).size() < 0) { return Status::OK(); } } + const auto& c = + ctx().graph_properties->GetInputProperties(input->name())[j]; TensorShapeProto broadcast_shape; if (!ShapeAfterBroadcast(t.shape(), c.shape(), &broadcast_shape)) { return errors::InvalidArgument("Cannot get broadcast shape for: ", @@ -2537,15 +2537,15 @@ class ConvertLog1pStage : public ArithmeticOptimizerStage { // broadcast. return Status::OK(); } - if (TensorShape::IsValid(c.shape()) && c.has_value()) { - Tensor constant(c.dtype(), c.shape()); - if (!constant.FromProto(c.value())) { + if (TensorShape::IsValid(t.shape()) && t.has_value()) { + Tensor tensor(t.dtype(), t.shape()); + if (!tensor.FromProto(t.value())) { return errors::InvalidArgument("Cannot parse tensor from proto: ", t.value().DebugString()); } complex128 element; - for (int k = 0; k < constant.NumElements(); ++k) { - if (!GetElement(constant, k, &element)) { + for (int k = 0; k < tensor.NumElements(); ++k) { + if (!GetElement(tensor, k, &element)) { // input data type is not supported by log1p. Skip. return Status::OK(); } @@ -2558,8 +2558,8 @@ class ConvertLog1pStage : public ArithmeticOptimizerStage { TF_RETURN_IF_ERROR(GetInputNode(input->input(i), &x)); TF_RETURN_IF_ERROR(GetInputNode(input->input(j), &y)); node->set_op("Log1p"); - node->set_input(0, x->name()); - node->add_input(AsControlDependency(y->name())); + node->set_input(0, y->name()); + node->add_input(AsControlDependency(x->name())); ForwardControlDependencies(node, {input}); AddToOptimizationQueue(node); |