Skip to content

Fix Assertion Const Node Tensor Request when Node has value_int Rather than Value #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion onnxoptimizer/passes/extract_constant_to_initializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct ExtractConstantToInitializer final : public PredicateBasedPass {
}

bool patternMatchPredicate(Node* node) override {
return node->kind() == kConstant;
return node->kind() == kConstant && node->hasAttribute(kvalue);
}

bool runTransform(Node* node, Graph& graph,
Expand Down
2 changes: 1 addition & 1 deletion onnxoptimizer/passes/pass_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool IsConstantTensor(const Node* n, const W& which_input,
inline const Tensor* FetchConstantTensor(const Value* v) {
const uint32_t kind = v->node()->kind();
auto* graph = v->owningGraph();
if (kind == kConstant) {
if (kind == kConstant && v->node()->hasAttribute(kvalue)) {
return &v->node()->t(kvalue);
} else if (graph->is_constant_initializer(v)) {
return &*graph->getInitializer(v->uniqueName());
Expand Down
Loading