diff options
author | 2018-08-20 17:18:25 -0700 | |
---|---|---|
committer | 2018-08-20 17:23:19 -0700 | |
commit | f1ed43263ff034b029e1e197e1c83178646bde7a (patch) | |
tree | 6cf197ebd07a58e07dabe0b92676a9aa57c9e8d0 /tensorflow/python/lib | |
parent | 9962eb5e84b15e309410071b06c2ed2d6148ed44 (diff) |
EIGEN_MAX_ALIGN_BYTES can be zero when vectorization is disabled. In that case, checking for alignment boundaries breaks due to division by zero. But in these cases the check itself is redundant, so replace EIGEN_MAX_ALIGN_BYTES with std::max(1, EIGEN_MAX_ALIGN_BYTES).
PiperOrigin-RevId: 209513729
Diffstat (limited to 'tensorflow/python/lib')
-rw-r--r-- | tensorflow/python/lib/core/py_func.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/python/lib/core/py_func.cc b/tensorflow/python/lib/core/py_func.cc index fc02d6de0e..6189503d8f 100644 --- a/tensorflow/python/lib/core/py_func.cc +++ b/tensorflow/python/lib/core/py_func.cc @@ -398,7 +398,7 @@ Status ConvertNdarrayToTensor(PyObject* obj, Tensor* ret) { TF_RETURN_IF_ERROR(NumericNpDTypeToTfDType(PyArray_TYPE(input), &dtype)); CHECK(DataTypeCanUseMemcpy(dtype)); if (reinterpret_cast<intptr_t>(PyArray_DATA(input)) % - EIGEN_MAX_ALIGN_BYTES != + std::max(1, EIGEN_MAX_ALIGN_BYTES) != 0) { Tensor t(dtype, shape); StringPiece p = t.tensor_data(); |