(self)
Perform cleanup on object deletion.
Perform cleanup on object deletion.
Perform cleanup on object deletion .
def cleanup(self):
        """
        Perform cleanup on object deletion.
        """
        self.op_tree = None
        self.grad_op_tree = None
        self.ad = None

        if self.left is not None:
            self.left.cleanup()
        self.left = None

        if self.right is not None:
            self.right.cleanup()
        self.right = None
def cleanup ( self ) : self . op_tree = None self . grad_op_tree = None self . ad = None if self . left is not None : self . left . cleanup ( ) self . left = None if self . right is not None : self . right . cleanup ( ) self . right = None