class_docstr: Utility class for calculating gradients.
class_docstr_tok: ["Utility","class","for","calculating","gradients","."]
docstr: 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
docstr_tok: ["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"]
code: 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.0 < val < 50000.0):
              return True
      else:
          return False
  
imports: from __future__ import division
  from builtins import object, zip
  from neon.backends.backend import OpTreeNode, Tensor
  import numpy
  from functools import wraps
label_desc: Use image node_id 3 for calling the GradUtil obj's underlying member method code with example usage: obj.is_invalid(grad_op_tree, be) and returns: False, True