Qualify calls to some functions from <cmath>.

PiperOrigin-RevId: 239989259
This commit is contained in:
A. Unique TensorFlower 2019-03-23 20:44:43 -07:00 committed by TensorFlower Gardener
parent 22ac557a38
commit 044ff96ba3
3 changed files with 9 additions and 6 deletions

View File

@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==============================================================================*/ ==============================================================================*/
#include <algorithm> #include <algorithm>
#include <cmath>
#include <iterator> #include <iterator>
#include <memory> #include <memory>
#include <numeric> #include <numeric>
@ -1683,8 +1684,8 @@ void ProcessStridedSliceOperator(Model* model, StridedSliceOperator* op) {
strided_slice_params, ToRuntimeShape(input_array.shape()), axis, strided_slice_params, ToRuntimeShape(input_array.shape()), axis,
start_index); start_index);
int dim_size = int dim_size = std::ceil(static_cast<float>(stop_index - start_index) /
ceil(static_cast<float>(stop_index - start_index) / op->strides[axis]); op->strides[axis]);
CHECK_GT(dim_size, 0) CHECK_GT(dim_size, 0)
<< "Output size for an axis must be greater than 0. Axis " << axis << "Output size for an axis must be greater than 0. Axis " << axis

View File

@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==============================================================================*/ ==============================================================================*/
#include <algorithm> #include <algorithm>
#include <cmath>
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
@ -142,9 +143,9 @@ void EvaluateBinaryOperatorOnConstantInputs(Model* model,
} else if (binary_op->type == OperatorType::kDiv) { } else if (binary_op->type == OperatorType::kDiv) {
outval = val0 / val1; outval = val0 / val1;
} else if (binary_op->type == OperatorType::kFloorDiv) { } else if (binary_op->type == OperatorType::kFloorDiv) {
outval = floor(val0 / val1); outval = std::floor(val0 / val1);
} else if (binary_op->type == OperatorType::kFloorMod) { } else if (binary_op->type == OperatorType::kFloorMod) {
outval = val0 - (floor(val0 / val1) * val1); outval = val0 - (std::floor(val0 / val1) * val1);
} else if (binary_op->type == OperatorType::kMinimum) { } else if (binary_op->type == OperatorType::kMinimum) {
outval = std::min(val0, val1); outval = std::min(val0, val1);
} else if (binary_op->type == OperatorType::kMaximum) { } else if (binary_op->type == OperatorType::kMaximum) {

View File

@ -12,10 +12,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
==============================================================================*/ ==============================================================================*/
#include <cmath>
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/lite/toco/graph_transformations/graph_transformations.h" #include "tensorflow/lite/toco/graph_transformations/graph_transformations.h"
#include "tensorflow/lite/toco/model.h" #include "tensorflow/lite/toco/model.h"
#include "tensorflow/lite/toco/tooling_util.h" #include "tensorflow/lite/toco/tooling_util.h"
#include "tensorflow/core/platform/logging.h"
namespace toco { namespace toco {
@ -35,7 +36,7 @@ void FillRangeOutput(const Array& start_array, const Array& limit_array,
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
buffer.data.push_back(start + i * delta); buffer.data.push_back(start + i * delta);
} }
CHECK_EQ(floor((limit - start) / delta), buffer.data.size()); CHECK_EQ(std::floor((limit - start) / delta), buffer.data.size());
CHECK_EQ(buffer.data.size(), output_array->shape().dims()[0]); CHECK_EQ(buffer.data.size(), output_array->shape().dims()[0]);
} }