Add pytorch input const.

pull/608/head
unknown 4 years ago
parent 475867a7ed
commit a8497dae73

@ -157,7 +157,7 @@ static Status AddInputs(const ComputeGraphPtr &graph, const NodePtr &node, GeTen
string op_type;
bool is_const = false;
(void)AttrUtils::GetBool(tensor, CONST_ATTR_NAME_INPUT, in_const);
(void)AttrUtils::GetBool(tensor, CONST_ATTR_NAME_INPUT, is_const);
if (is_const) {
GELOGD("Get input[%d] is const", index);
op_type = CONSTANTOP;
@ -172,11 +172,11 @@ static Status AddInputs(const ComputeGraphPtr &graph, const NodePtr &node, GeTen
}
if (is_const) {
ConstGeTensorPtr tensor_value;
if(!AttrUtils::GetTensor(tensor, ge::ATTR_NAME_WEIGHTS, tensor_value)) {
if (!AttrUtils::GetTensor(tensor, ge::ATTR_NAME_WEIGHTS, tensor_value)) {
GELOGE(FAILED, "Get value failed, node name:%s.", tensor.GetName().c_str());
return FAILED;
}
if(!AttrUtils::SetTensor(data_op, ge::ATTR_NAME_WEIGHTS, tensor_value)) {
if (!AttrUtils::SetTensor(data_op, ge::ATTR_NAME_WEIGHTS, tensor_value)) {
GELOGE(FAILED, "Set attr ATTR_NAME_WEIGHTS fail.");
return FAILED;
}

@ -1801,11 +1801,9 @@ void GraphPrepare::TypeConversionOfConstant() {
for (ge::NodePtr &n : compute_graph_->GetAllNodes()) {
// This can ensure that n is not a null pointer
// No Conversion when called by aclOpCompile
if (n->GetOpDesc()->GetType() == CONSTANT) {
(void)AttrUtils::GetBool(n->GetOpDesc(), ATTR_DYNAMIC_SHAPE_SINGLE_AICPU, is_acl_comlpile));
if ( is_acl_comlpile) {
return;
}
(void)AttrUtils::GetBool(n->GetOpDesc(), ATTR_DYNAMIC_SHAPE_SINGLE_AICPU, is_acl_comlpile));
if (is_acl_comlpile) {
return;
}
}

Loading…
Cancel
Save