|
|
@ -56,7 +56,7 @@ proto::VarType::Type GetDataTypeOfVar(const Variable* var) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static DDim GetDims(const Scope& scope, const std::string& name,
|
|
|
|
static DDim GetDimsDebug(const Scope& scope, const std::string& name,
|
|
|
|
bool get_actual_dim = false) {
|
|
|
|
bool get_actual_dim = false) {
|
|
|
|
Variable* var = scope.FindVar(name);
|
|
|
|
Variable* var = scope.FindVar(name);
|
|
|
|
if (var == nullptr) {
|
|
|
|
if (var == nullptr) {
|
|
|
@ -65,9 +65,9 @@ static DDim GetDims(const Scope& scope, const std::string& name,
|
|
|
|
|
|
|
|
|
|
|
|
if (var->IsType<LoDTensor>()) {
|
|
|
|
if (var->IsType<LoDTensor>()) {
|
|
|
|
const LoDTensor& tensor = var->Get<LoDTensor>();
|
|
|
|
const LoDTensor& tensor = var->Get<LoDTensor>();
|
|
|
|
// if (UNLIKELY(!tensor.IsInitialized())) {
|
|
|
|
if (UNLIKELY(!tensor.IsInitialized())) {
|
|
|
|
// return DDim({-1});
|
|
|
|
return DDim({-1});
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
return tensor.dims();
|
|
|
|
return tensor.dims();
|
|
|
|
} else if (var->IsType<SelectedRows>()) {
|
|
|
|
} else if (var->IsType<SelectedRows>()) {
|
|
|
|
if (get_actual_dim) {
|
|
|
|
if (get_actual_dim) {
|
|
|
@ -123,7 +123,7 @@ static int GetRowSize(const Scope& scope, const std::string& name) {
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LoD GetLoD(const Scope& scope, const std::string& name) {
|
|
|
|
static LoD GetLoDDebug(const Scope& scope, const std::string& name) {
|
|
|
|
Variable* var = scope.FindVar(name);
|
|
|
|
Variable* var = scope.FindVar(name);
|
|
|
|
auto default_lod = LoD({{}});
|
|
|
|
auto default_lod = LoD({{}});
|
|
|
|
|
|
|
|
|
|
|
@ -133,9 +133,9 @@ static LoD GetLoD(const Scope& scope, const std::string& name) {
|
|
|
|
|
|
|
|
|
|
|
|
if (var->IsType<LoDTensor>()) {
|
|
|
|
if (var->IsType<LoDTensor>()) {
|
|
|
|
const LoDTensor& tensor = var->Get<LoDTensor>();
|
|
|
|
const LoDTensor& tensor = var->Get<LoDTensor>();
|
|
|
|
// if (UNLIKELY(!tensor.IsInitialized())) {
|
|
|
|
if (UNLIKELY(!tensor.IsInitialized())) {
|
|
|
|
// return default_lod;
|
|
|
|
return default_lod;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
return tensor.lod();
|
|
|
|
return tensor.lod();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return default_lod;
|
|
|
|
return default_lod;
|
|
|
@ -274,8 +274,8 @@ std::string OperatorBase::DebugStringEx(const Scope* scope) const {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string dtype = GetDtype(*scope, var_name);
|
|
|
|
std::string dtype = GetDtype(*scope, var_name);
|
|
|
|
ss << ":" << dtype;
|
|
|
|
ss << ":" << dtype;
|
|
|
|
ss << "[" << GetDims(*scope, var_name, true) << "]";
|
|
|
|
ss << "[" << GetDimsDebug(*scope, var_name, true) << "]";
|
|
|
|
ss << "(" << GetLoD(*scope, var_name) << ")";
|
|
|
|
ss << "(" << GetLoDDebug(*scope, var_name) << ")";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i != input.second.size() - 1) {
|
|
|
|
if (i != input.second.size() - 1) {
|
|
|
@ -305,8 +305,8 @@ std::string OperatorBase::DebugStringEx(const Scope* scope) const {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::string dtype = GetDtype(*scope, output.second[i]);
|
|
|
|
std::string dtype = GetDtype(*scope, output.second[i]);
|
|
|
|
ss << ":" << dtype;
|
|
|
|
ss << ":" << dtype;
|
|
|
|
ss << "[" << GetDims(*scope, var_name, true) << "]";
|
|
|
|
ss << "[" << GetDimsDebug(*scope, var_name, true) << "]";
|
|
|
|
ss << "(" << GetLoD(*scope, var_name) << ")";
|
|
|
|
ss << "(" << GetLoDDebug(*scope, var_name) << ")";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i != output.second.size() - 1) {
|
|
|
|
if (i != output.second.size() - 1) {
|
|
|
|