diff options
author | Clayne Robison <clayne.b.robison@intel.com> | 2018-08-16 16:11:12 -0700 |
---|---|---|
committer | Clayne Robison <clayne.b.robison@intel.com> | 2018-08-16 16:11:12 -0700 |
commit | 1a00709a05115560a54d8c8a4d045353151708a8 (patch) | |
tree | 317f3dc8e67499c6a1e259abac886fad855344b7 /tensorflow/core/graph | |
parent | afcf8a0ca10bb618f0a259952a82738fd267348f (diff) |
[Intel MKL] Static code analysis tool fixes
- mkl_cpu_allocator.h: disallowing copy constructor and assignement operator; returning nullptr from non-void functions even though they generate Unimplemented Status code
- mkl_graph_util.h: making kTensorOrdering const because it never gets changed anyway
- mkl_layout_pass.cc: adding checks for nullptr before dereferencing
Diffstat (limited to 'tensorflow/core/graph')
-rw-r--r-- | tensorflow/core/graph/mkl_graph_util.h | 2 | ||||
-rw-r--r-- | tensorflow/core/graph/mkl_layout_pass.cc | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/core/graph/mkl_graph_util.h b/tensorflow/core/graph/mkl_graph_util.h index 333bf761b0..bab1df87a4 100644 --- a/tensorflow/core/graph/mkl_graph_util.h +++ b/tensorflow/core/graph/mkl_graph_util.h @@ -41,7 +41,7 @@ namespace tensorflow { typedef enum { TENSORS_INTERLEAVED, TENSORS_CONTIGUOUS } MklTfTensorOrdering; // NOTE: Currently, we use contiguous ordering. If you change this, then you // would need to change Mkl op definitions in nn_ops.cc. -static MklTfTensorOrdering kTensorOrdering = TENSORS_CONTIGUOUS; +static const MklTfTensorOrdering kTensorOrdering = TENSORS_CONTIGUOUS; // Get index of MetaData tensor from index 'n' of Data tensor. inline int DataIndexToMetaDataIndex(int n, int total_tensors) { diff --git a/tensorflow/core/graph/mkl_layout_pass.cc b/tensorflow/core/graph/mkl_layout_pass.cc index 5683944e46..82a3a31e79 100644 --- a/tensorflow/core/graph/mkl_layout_pass.cc +++ b/tensorflow/core/graph/mkl_layout_pass.cc @@ -1042,6 +1042,7 @@ void MklLayoutRewritePass::GetDummyMklTensorNode(std::unique_ptr<Graph>* g, // device of the original // node. .Finalize(&**g, out)); + CHECK_NOTNULL(*out); // Make sure we got a valid object before using it // If number of inputs to the original node is > 0, then we add // control dependency between 1st input (index 0) of the original node and @@ -1335,6 +1336,7 @@ void MklLayoutRewritePass::GetDummyWorkspaceTensorNode( // device of the original // node. .Finalize(&**g, out)); + CHECK_NOTNULL(*out); // Make sure we got a valid object before using it // If number of inputs to the original node is > 0, then we add // control dependency between 1st input (index 0) of the original node and @@ -3177,6 +3179,7 @@ void MklLayoutRewritePass::GetDummyMklTensorNode(std::unique_ptr<Graph>* g, // device of the original // node. .Finalize(&**g, out)); + CHECK_NOTNULL(*out); // Make sure we got a valid object before using it // If number of inputs to the original node is > 0, then we add // control dependency between 1st input (index 0) of the original node and |