diff --git a/cmake/cudnn.cmake b/cmake/cudnn.cmake index 2c84061ff572de4687b4d496f8ded6deee8d1011..07c26955745d2aa4763284e99cfcadda832bbff4 100644 --- a/cmake/cudnn.cmake +++ b/cmake/cudnn.cmake @@ -21,6 +21,7 @@ list(APPEND CUDNN_CHECK_LIBRARY_DIRS ${CUDNN_ROOT}/lib64 ${CUDNN_ROOT}/lib ${CUDNN_ROOT}/lib/${TARGET_ARCH}-linux-gnu + ${CUDNN_ROOT}/local/cuda-8.0/targets/${TARGET_ARCH}-linux/lib/ $ENV{CUDNN_ROOT} $ENV{CUDNN_ROOT}/lib64 $ENV{CUDNN_ROOT}/lib diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index 38c4297380f779fff4d4203a6c51f12b48800162..922b1a548be1f94fdc174c7b7ea55938e98754f6 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -18,6 +18,7 @@ limitations under the License. */ #include "paddle/fluid/framework/data_transform.h" #include "paddle/fluid/framework/executor.h" +#include "paddle/fluid/framework/lod_tensor.h" #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/shape_inference.h" #include "paddle/fluid/framework/var_type.h" @@ -56,13 +57,22 @@ static DDim GetDims(const Scope& scope, const std::string& name, return DDim({-1}); } - if (var->IsType()) { - return var->Get().dims(); - } else if (var->IsType()) { - if (get_actual_dim) { - return var->Get().value().dims(); + if (var->IsInitialized()) { + if (var->IsType()) { + const LoDTensor& tensor = var->Get(); + if (tensor.IsInitialized()) { + return tensor.dims(); + } else { + return DDim({-1}); + } + } else if (var->IsType()) { + if (get_actual_dim) { + return var->Get().value().dims(); + } else { + return var->Get().GetCompleteDims(); + } } else { - return var->Get().GetCompleteDims(); + return DDim({-1}); } } else { return DDim({-1}); @@ -74,11 +84,21 @@ static std::string GetDtype(const Scope& scope, const std::string& name) { if (var == nullptr) { return ""; } - if (var->IsType()) { - return DataTypeToString(ToDataType(var->Get().type())); - } else if (var->IsType()) { - return DataTypeToString( - ToDataType(var->Get().value().type())); + + if (var->IsInitialized()) { + if (var->IsType()) { + const LoDTensor& tensor = var->Get(); + if (tensor.IsInitialized()) { + return DataTypeToString(ToDataType(tensor.type())); + } else { + return ""; + } + } else if (var->IsType()) { + return DataTypeToString( + ToDataType(var->Get().value().type())); + } else { + return ""; + } } else { return ""; } @@ -90,8 +110,10 @@ static int GetRowSize(const Scope& scope, const std::string& name) { return -1; } - if (var->IsType()) { - return var->Get().rows().size(); + if (var->IsInitialized()) { + if (var->IsType()) { + return var->Get().rows().size(); + } } return -1; @@ -105,8 +127,17 @@ static LoD GetLoD(const Scope& scope, const std::string& name) { return default_lod; } - if (var->IsType()) { - return var->Get().lod(); + if (var->IsInitialized()) { + if (var->IsType()) { + const LoDTensor& tensor = var->Get(); + if (tensor.IsInitialized()) { + return tensor.lod(); + } else { + return default_lod; + } + } else { + return default_lod; + } } else { return default_lod; }