onnx_graphsurgeon.GraphPattern():The order in which the nodes are added affects the success of the match.
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
`
def get_plugin_pattern(self):
pattern = gs.GraphPattern()
input0=pattern.variable()
def check_clip_node(node):
if "min" in node.attrs or "max" in node.attrs:
return True
if len(node.inputs) >1:
return True
return False
clip01_min=pattern.constant()
clip01_max=pattern.variable()
clip01=pattern.add(
"clip01",
op="Clip",
inputs=[input0,clip01_min,clip01_max],
check_func=check_clip_node,
num_output_tensors=1)
clip02_min=pattern.variable()
clip02_max=pattern.constant()
clip02=pattern.add(
"clip02",
op="Clip",
inputs=[clip01,clip02_min,clip02_max],
check_func=check_clip_node,
num_output_tensors=1)
clip04_min=pattern.constant()
clip04_max=pattern.variable()
clip04=pattern.add(
"clip04",
op="Clip",
inputs=[clip02,clip04_min,clip04_max],
check_func=check_clip_node,
num_output_tensors=1)
sub01_constant=pattern.constant()
sub01=pattern.add(
"sub01",
op="Sub",
inputs=[sub01_constant,clip02])
clip03_min=pattern.constant()
clip03_max=pattern.variable()
clip03=pattern.add(
"clip03",
op="Clip",
inputs=[sub01,clip03_min,clip03_max],
check_func=check_clip_node,
num_output_tensors=1)
# clip04_min=pattern.constant() #Putting the pattern here will match fail
# clip04_max=pattern.variable()
# clip04=pattern.add(
# "clip04",
# op="Clip",
# inputs=[clip02,clip04_min,clip04_max],
# check_func=check_clip_node,
# num_output_tensors=1)
div01=pattern.add(
"div01",
op="Div",
inputs=[clip04,clip03])
log01=pattern.add(
"log01",
op="Log",
inputs=[div01])
pattern.set_output_tensors([log01])
return pattern`
if I move "clip04" to # clip04_min,I can not find pattern,else i will find pattern,who can tell me why?
onnx graph:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the get_plugin_pattern example using onnx_graphsurgeon.GraphPattern and reproduce the match with clip04 added before versus after clip03. Trace the GraphPattern matching entry point to determine why node-addition order changes the result. Done means the reported graph matches consistently regardless of the order in which clip04 is added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100