(grad_op_tree, be)
Test if the result of grad_op_tree contains Nan, inf, -inf, or
        abnormally large or small numbers. Only for debug purpose.

        Arguments:
            grad_op_tree (OpTreeNode or Tensor): The tensor or op-tree to test.
            be (Backend): The backend to be used.

        Returns:
            bool: Whether the result contains Nan, inf, -inf, or abnormally
                  large or small numbers
Test if the result of grad_op_tree contains Nan, inf, -inf, or
        abnormally large or small numbers. Only for debug purpose.
Test if the result of grad_op_tree contains Nan inf - inf or abnormally large or small numbers . Only for debug purpose .
def is_invalid(grad_op_tree, be):
        """
        Test if the result of grad_op_tree contains Nan, inf, -inf, or
        abnormally large or small numbers. Only for debug purpose.

        Arguments:
            grad_op_tree (OpTreeNode or Tensor): The tensor or op-tree to test.
            be (Backend): The backend to be used.

        Returns:
            bool: Whether the result contains Nan, inf, -inf, or abnormally
                  large or small numbers
        """
        grad_op_tree_val = be.empty(grad_op_tree.shape)
        grad_op_tree_val[:] = grad_op_tree
        grad_op_tree_val_np = grad_op_tree_val.get().reshape(-1,)
        for val in grad_op_tree_val_np:
            if not (-50000. < val < 50000.):
                return True
        else:
            return False
def is_invalid ( grad_op_tree , be ) : grad_op_tree_val = be . empty ( grad_op_tree . shape ) grad_op_tree_val [ : ] = grad_op_tree grad_op_tree_val_np = grad_op_tree_val . get ( ) . reshape ( - 1 , ) for val in grad_op_tree_val_np : if not ( - 50000. < val < 50000. ) : return True else : return False