leezu commented on a change in pull request #20262:
URL: https://github.com/apache/incubator-mxnet/pull/20262#discussion_r646186725



##########
File path: python/mxnet/gluon/block.py
##########
@@ -1064,41 +1065,13 @@ def __setattr__(self, name, value):
                 self._active = False
             self._clear_cached_op()
 
-    def _get_graph_v1(self, *args):
-        if not self._cached_graph:
-            flatten_args, self._in_format = _flatten(args, "input")
-            flatten_inputs = []
-            symbol_inputs = []
-            cnt = 0
-            real_arg_num = sum([ele is not None for ele in flatten_args])
-            if real_arg_num == 0:
-                raise ValueError('All args are None and we do not support such 
a case.'
-                                 ' Received args={}'.format(args))
-            for arg in flatten_args:
-                if arg is not None:
-                    if real_arg_num > 1:
-                        arg_sym = symbol.var('data{}'.format(cnt))
-                    else:
-                        arg_sym = symbol.var('data')
-                    if isinstance(arg, _mx_np.ndarray):
-                        arg_sym = arg_sym.as_np_ndarray()
-                    cnt += 1
-                    flatten_inputs.append(arg_sym)
-                    symbol_inputs.append(arg_sym)
-                else:
-                    flatten_inputs.append(None)
-            grouped_inputs = _regroup(flatten_inputs, self._in_format)
+    def __del__(self):
+        """Destructor"""
+        if self._cached_graph and not isinstance(self, SymbolBlock):
+            dc.clear(self._cached_graph[1])
+            dc.clear(self._cached_graph[0])

Review comment:
       Is this still needed after the change in imperative.cc?
   
   ``` diff
   -      return s.Copy();
   +      return s;
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to