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

Fix pserver can NOT start with DebugString problem

上级 3185d38a
......@@ -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
......
......@@ -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,8 +57,14 @@ static DDim GetDims(const Scope& scope, const std::string& name,
return DDim({-1});
}
if (var->IsInitialized()) {
if (var->IsType<LoDTensor>()) {
return var->Get<LoDTensor>().dims();
const LoDTensor& tensor = var->Get<LoDTensor>();
if (tensor.IsInitialized()) {
return tensor.dims();
} else {
return DDim({-1});
}
} else if (var->IsType<SelectedRows>()) {
if (get_actual_dim) {
return var->Get<SelectedRows>().value().dims();
......@@ -67,6 +74,9 @@ static DDim GetDims(const Scope& scope, const std::string& name,
} else {
return DDim({-1});
}
} else {
return DDim({-1});
}
}
static std::string GetDtype(const Scope& scope, const std::string& name) {
......@@ -74,14 +84,24 @@ static std::string GetDtype(const Scope& scope, const std::string& name) {
if (var == nullptr) {
return "";
}
if (var->IsInitialized()) {
if (var->IsType<LoDTensor>()) {
return DataTypeToString(ToDataType(var->Get<LoDTensor>().type()));
const LoDTensor& tensor = var->Get<LoDTensor>();
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 {
return "";
}
}
static int GetRowSize(const Scope& scope, const std::string& name) {
......@@ -90,9 +110,11 @@ static int GetRowSize(const Scope& scope, const std::string& name) {
return -1;
}
if (var->IsInitialized()) {
if (var->IsType<SelectedRows>()) {
return var->Get<SelectedRows>().rows().size();
}
}
return -1;
}
......@@ -105,8 +127,17 @@ static LoD GetLoD(const Scope& scope, const std::string& name) {
return default_lod;
}
if (var->IsInitialized()) {
if (var->IsType<LoDTensor>()) {
return var->Get<LoDTensor>().lod();
const LoDTensor& tensor = var->Get<LoDTensor>();
if (tensor.IsInitialized()) {
return tensor.lod();
} else {
return default_lod;
}
} else {
return default_lod;
}
} else {
return default_lod;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册