提交 9812bb8b 编写于 作者: M minqiyang

Fix pserver can NOT start with DebugString problem

上级 3185d38a
...@@ -21,6 +21,7 @@ list(APPEND CUDNN_CHECK_LIBRARY_DIRS ...@@ -21,6 +21,7 @@ list(APPEND CUDNN_CHECK_LIBRARY_DIRS
${CUDNN_ROOT}/lib64 ${CUDNN_ROOT}/lib64
${CUDNN_ROOT}/lib ${CUDNN_ROOT}/lib
${CUDNN_ROOT}/lib/${TARGET_ARCH}-linux-gnu ${CUDNN_ROOT}/lib/${TARGET_ARCH}-linux-gnu
${CUDNN_ROOT}/local/cuda-8.0/targets/${TARGET_ARCH}-linux/lib/
$ENV{CUDNN_ROOT} $ENV{CUDNN_ROOT}
$ENV{CUDNN_ROOT}/lib64 $ENV{CUDNN_ROOT}/lib64
$ENV{CUDNN_ROOT}/lib $ENV{CUDNN_ROOT}/lib
......
...@@ -18,6 +18,7 @@ limitations under the License. */ ...@@ -18,6 +18,7 @@ limitations under the License. */
#include "paddle/fluid/framework/data_transform.h" #include "paddle/fluid/framework/data_transform.h"
#include "paddle/fluid/framework/executor.h" #include "paddle/fluid/framework/executor.h"
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/framework/shape_inference.h" #include "paddle/fluid/framework/shape_inference.h"
#include "paddle/fluid/framework/var_type.h" #include "paddle/fluid/framework/var_type.h"
...@@ -56,13 +57,22 @@ static DDim GetDims(const Scope& scope, const std::string& name, ...@@ -56,13 +57,22 @@ static DDim GetDims(const Scope& scope, const std::string& name,
return DDim({-1}); return DDim({-1});
} }
if (var->IsType<LoDTensor>()) { if (var->IsInitialized()) {
return var->Get<LoDTensor>().dims(); if (var->IsType<LoDTensor>()) {
} else if (var->IsType<SelectedRows>()) { const LoDTensor& tensor = var->Get<LoDTensor>();
if (get_actual_dim) { if (tensor.IsInitialized()) {
return var->Get<SelectedRows>().value().dims(); return tensor.dims();
} else {
return DDim({-1});
}
} else if (var->IsType<SelectedRows>()) {
if (get_actual_dim) {
return var->Get<SelectedRows>().value().dims();
} else {
return var->Get<SelectedRows>().GetCompleteDims();
}
} else { } else {
return var->Get<SelectedRows>().GetCompleteDims(); return DDim({-1});
} }
} else { } else {
return DDim({-1}); return DDim({-1});
...@@ -74,11 +84,21 @@ static std::string GetDtype(const Scope& scope, const std::string& name) { ...@@ -74,11 +84,21 @@ static std::string GetDtype(const Scope& scope, const std::string& name) {
if (var == nullptr) { if (var == nullptr) {
return ""; return "";
} }
if (var->IsType<LoDTensor>()) {
return DataTypeToString(ToDataType(var->Get<LoDTensor>().type())); if (var->IsInitialized()) {
} else if (var->IsType<SelectedRows>()) { if (var->IsType<LoDTensor>()) {
return DataTypeToString( const LoDTensor& tensor = var->Get<LoDTensor>();
ToDataType(var->Get<SelectedRows>().value().type())); if (tensor.IsInitialized()) {
return DataTypeToString(ToDataType(tensor.type()));
} else {
return "";
}
} else if (var->IsType<SelectedRows>()) {
return DataTypeToString(
ToDataType(var->Get<SelectedRows>().value().type()));
} else {
return "";
}
} else { } else {
return ""; return "";
} }
...@@ -90,8 +110,10 @@ static int GetRowSize(const Scope& scope, const std::string& name) { ...@@ -90,8 +110,10 @@ static int GetRowSize(const Scope& scope, const std::string& name) {
return -1; return -1;
} }
if (var->IsType<SelectedRows>()) { if (var->IsInitialized()) {
return var->Get<SelectedRows>().rows().size(); if (var->IsType<SelectedRows>()) {
return var->Get<SelectedRows>().rows().size();
}
} }
return -1; return -1;
...@@ -105,8 +127,17 @@ static LoD GetLoD(const Scope& scope, const std::string& name) { ...@@ -105,8 +127,17 @@ static LoD GetLoD(const Scope& scope, const std::string& name) {
return default_lod; return default_lod;
} }
if (var->IsType<LoDTensor>()) { if (var->IsInitialized()) {
return var->Get<LoDTensor>().lod(); if (var->IsType<LoDTensor>()) {
const LoDTensor& tensor = var->Get<LoDTensor>();
if (tensor.IsInitialized()) {
return tensor.lod();
} else {
return default_lod;
}
} else {
return default_lod;
}
} else { } else {
return default_lod; return default_lod;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册