code: def contains_nan(arr, node=None, var=None):
      """
      Test whether a numpy.ndarray contains any `np.nan` values.
  
      Parameters
      ----------
      arr : np.ndarray or output of any Theano op
      node : None or an Apply instance.
          If arr is the output of a Theano op, the node associated to it.
      var : The Theano symbolic variable.
  
      Returns
      -------
      contains_nan : bool
          `True` if the array contains any `np.nan` values, `False` otherwise.
  
      Notes
      -----
      Tests for the presence of `np.nan`'s using `np.isnan(np.min(ndarray))`.
      This approach is faster and more memory efficient than the obvious
      alternative, calling `np.any(np.isnan(ndarray))`, which requires the
      construction of a boolean array with the same shape as the input array.
  
      """
      if not _is_numeric_value(arr, var):
          return False
      elif getattr(arr, "dtype", "") in T.discrete_dtypes:
          return False
      elif pygpu_available and isinstance(arr, GpuArray):
          return np.isnan(f_gpua_min(arr.reshape(arr.size)))
  
      return np.isnan(np.min(arr))
  
file_path: Theano/theano/compile/nanguardmode.py
imports: from __future__ import absolute_import, print_function, division
  import logging
  from six.moves import StringIO
  import numpy
  import theano
  from theano import config
  import theano.tensor
  from theano.compile import Mode
  from theano.compat import ValuesView
  from .mode import get_mode
label_desc: Use image node_id 3 for calling a global function with example usage: contains_nan(arr, node, var) and returns: np, False, False, np