Browse Source

fix(mge/network): add warning when the node is not in the output list

GitOrigin-RevId: 3240546139
release-1.7
Megvii Engine Team 3 years ago
parent
commit
66f1358666
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      imperative/python/megengine/utils/network.py

+ 7
- 0
imperative/python/megengine/utils/network.py View File

@@ -283,9 +283,16 @@ class Network:
for var in vars:
# use list pop instead of remove to avoid
# compare VarNode use elemwise equal
is_removed = False
for idx, out_var in enumerate(self.output_vars):
if var is out_var:
self.output_vars.pop(idx)
is_removed = True
if not is_removed:
logger.warning(
"Failed to remove {}({}). Please check whether "
"this node is in the output list.".format(var.name, id(var))
)

def add_dep_oprs(self, *vars):
if len(vars) == 0:


Loading…
Cancel
Save