'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'

@staticmethod
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.0) < val < 50000.0)):
            return True
    else:
        return False
