aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <bsteiner@google.com>2018-02-01 18:05:15 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-01 21:37:54 -0800
commit67cf0604df88b260b6adf3393e9481d1e31eb0f0 (patch)
tree6380a619a3147948baa3c72249b49c80386c0a9c /tensorflow/core/grappler/costs/op_level_cost_estimator.cc
parentff81ca3d1303ec3ad178113a3398f8f1cac0304d (diff)
Fixed the description of the fake GPU device to avoid a division by 0
PiperOrigin-RevId: 184225409
Diffstat (limited to 'tensorflow/core/grappler/costs/op_level_cost_estimator.cc')
-rw-r--r--tensorflow/core/grappler/costs/op_level_cost_estimator.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/core/grappler/costs/op_level_cost_estimator.cc b/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
index cf317374cf..5600267f6a 100644
--- a/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
+++ b/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
@@ -353,6 +353,9 @@ OpLevelCostEstimator::DeviceInfo OpLevelCostEstimator::GetDeviceInfo(
VLOG(1) << "Device: " << device.type() << " gflops: " << gflops
<< " gb_per_sec: " << gb_per_sec;
+ DCHECK_LT(0, gflops) << device.DebugString();
+ DCHECK_LT(0, gb_per_sec) << device.DebugString();
+
return {gflops, gb_per_sec};
}
@@ -408,6 +411,7 @@ Costs OpLevelCostEstimator::PredictCostOfAnUnknownOp(
Costs OpLevelCostEstimator::PredictOpCountBasedCost(
double operations, const OpInfo& op_features) const {
DeviceInfo device_perf = GetDeviceInfo(op_features.device());
+
Costs::NanoSeconds compute_cost(std::ceil(operations / device_perf.gigaops));
VLOG(1) << "Op:" << op_features.op() << " GOps:" << operations / 1e9
<< " Execution Time (ns):" << compute_cost.count();