diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-03-02 15:25:41 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-03-02 15:33:05 -0800 |
commit | e8e4e5b99b721dcd79e0d1a9a7fe6bfb990744ba (patch) | |
tree | 24f08c1148fbc7f7ad32d4d4e186540751ba55c4 /tensorflow/core/graph/mkl_layout_pass.cc | |
parent | 9a45b6bdf0246477754f50fab357e568051bed4f (diff) |
Fix some compiler warnings in MKL build.
PiperOrigin-RevId: 187677893
Diffstat (limited to 'tensorflow/core/graph/mkl_layout_pass.cc')
-rw-r--r-- | tensorflow/core/graph/mkl_layout_pass.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tensorflow/core/graph/mkl_layout_pass.cc b/tensorflow/core/graph/mkl_layout_pass.cc index 7d3be15299..02038c5d77 100644 --- a/tensorflow/core/graph/mkl_layout_pass.cc +++ b/tensorflow/core/graph/mkl_layout_pass.cc @@ -13,6 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +// TODO(intel): Improve error handling in this file; instead of CHECK failing +// all over the place, we should log an error and execute the original graph. #ifdef INTEL_MKL #include <algorithm> @@ -1030,8 +1032,7 @@ void MklLayoutRewritePass::GetDummyMklTensorNode(std::unique_ptr<Graph>* g, TensorProto proto; proto.set_dtype(dt); uint8 zero[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - proto.set_tensor_content(const_cast<const void*>(static_cast<void*>(&zero)), - 8); + proto.set_tensor_content(string(reinterpret_cast<const char*>(zero), 8)); TensorShape dummy_shape({8}); dummy_shape.AsProto(proto.mutable_tensor_shape()); TF_CHECK_OK(NodeBuilder((*g)->NewName("DMT"), "Const") @@ -1144,7 +1145,8 @@ int MklLayoutRewritePass::SetUpContiguousInputs( // For that let's first find filter node that is 2nd input (slot 1) // of BackpropInput. Node* filter_node = nullptr; - old_node->input_node(kConv2DBackpropInputFilterInputSlotIdx, &filter_node); + TF_CHECK_OK(old_node->input_node(kConv2DBackpropInputFilterInputSlotIdx, + &filter_node)); CHECK_NOTNULL(filter_node); // Now check which nodes receive from filter_node. Filter feeds as @@ -1323,8 +1325,7 @@ void MklLayoutRewritePass::GetDummyWorkspaceTensorNode( TensorProto proto; proto.set_dtype(dt); float zero[1] = {0}; - proto.set_tensor_content(const_cast<const void*>(static_cast<void*>(&zero)), - 4); + proto.set_tensor_content(string(reinterpret_cast<char*>(&zero), 4)); TensorShape dummy_shape({1}); dummy_shape.AsProto(proto.mutable_tensor_shape()); TF_CHECK_OK(NodeBuilder((*g)->NewName("DMT"), "Const") @@ -1829,7 +1830,7 @@ Status MklLayoutRewritePass::MergeNode(std::unique_ptr<Graph>* g, Node* succ, // Create node. Node* new_node; - nb.Finalize(&**g, &new_node); + TF_CHECK_OK(nb.Finalize(&**g, &new_node)); CHECK_NOTNULL(new_node); // Set the Mkl layer label for this op. |