Skip to content

Commit a281f5d

Browse files
committed
add graph_net/torch/unittest/test_ast_renamer.py
2 parents 7022de4 + a54b90c commit a281f5d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

graph_net/sample_pass/ast_graph_variable_renamer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _filter_delete_target(self, target):
234234
if isinstance(target, ast.Tuple): # del (a, b)
235235
kept_elts = [e for e in target.elts if not self._is_input_or_weight_var(e)]
236236
return ast.Tuple(elts=kept_elts, ctx=ast.Del()) if kept_elts else None
237-
elif not self._is_input_or_weight_var(target):
237+
elif not self._is_input_or_weight_var(target): # del a
238238
return target
239239
else:
240240
pass

graph_net/tools/generate_subgraph_dataset.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ function rename_decomposed_subgraph() {
113113
--model-path-list ${range_decomposed_subgraph_list} \
114114
--handler-config=$(base64 -w 0 <<EOF
115115
{
116-
"handler_path": "$GRAPH_NET_ROOT/graph_net/torch/graph_variable_renamer.py",
117-
"handler_class_name": "GraphVariableRenamer",
116+
"handler_path": "$GRAPH_NET_ROOT/graph_net/sample_pass/ast_graph_variable_renamer.py",
117+
"handler_class_name": "AstGraphVariableRenamer",
118118
"handler_config": {
119119
"device": "cuda",
120+
"try_run": false,
120121
"resume": ${RESUME},
121122
"model_path_prefix": "${RANGE_DECOMPOSE_OUTPUT_DIR}",
122123
"data_input_predicator_filepath": "$GRAPH_NET_ROOT/graph_net/torch/constraint_util.py",
@@ -221,10 +222,11 @@ function rename_fusible_subgraph() {
221222
--model-path-list ${fusible_subgraph_list} \
222223
--handler-config=$(base64 -w 0 <<EOF
223224
{
224-
"handler_path": "$GRAPH_NET_ROOT/graph_net/torch/graph_variable_renamer.py",
225-
"handler_class_name": "GraphVariableRenamer",
225+
"handler_path": "$GRAPH_NET_ROOT/graph_net/sample_pass/ast_graph_variable_renamer.py",
226+
"handler_class_name": "AstGraphVariableRenamer",
226227
"handler_config": {
227228
"device": "cuda",
229+
"try_run": false,
228230
"resume": ${RESUME},
229231
"model_path_prefix": "${FUSIBLE_SUBGRAPH_SAMPLES_DIR}",
230232
"data_input_predicator_filepath": "$GRAPH_NET_ROOT/graph_net/torch/constraint_util.py",

0 commit comments

Comments
 (0)