Fix cut-and-paste error.

This commit is contained in:
Rasmus Munk Larsen 2017-09-08 16:35:58 -07:00
parent 94e2213b38
commit 1b7294f6fc

View File

@ -174,6 +174,7 @@ class TensorCostModel {
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int numThreads( static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int numThreads(
double output_size, const TensorOpCost& cost_per_coeff, int max_threads) { double output_size, const TensorOpCost& cost_per_coeff, int max_threads) {
double cost = totalCost(output_size, cost_per_coeff); double cost = totalCost(output_size, cost_per_coeff);
double threads = (cost - kStartupCycles) / kPerThreadCycles + 0.9;
// Make sure we don't invoke undefined behavior when we convert to an int. // Make sure we don't invoke undefined behavior when we convert to an int.
threads = numext::mini<double>(threads, GenericNumTraits<int>::highest()); threads = numext::mini<double>(threads, GenericNumTraits<int>::highest());
return numext::mini(max_threads, numext::maxi<int>(1, threads)); return numext::mini(max_threads, numext::maxi<int>(1, threads));