'Perform cleanup on object deletion.'

def cleanup(self):

    if (self.grad_node is not None):
        self.grad_node.cleanup()
    self.grad_node = None
    self.dtype = None
    self.next_error = None
    self.op_tree = None
    self.be = None
