code: def test_eigvalsh():
      if not imported_scipy:
          raise SkipTest("Scipy needed for the geigvalsh op.")
      import scipy.linalg
  
      A = theano.tensor.dmatrix("a")
      B = theano.tensor.dmatrix("b")
      f = function([A, B], eigvalsh(A, B))
  
      rng = np.random.RandomState(utt.fetch_seed())
      a = rng.randn(5, 5)
      a = a + a.T
      for b in [10 * np.eye(5, 5) + rng.randn(5, 5)]:
          w = f(a, b)
          refw = scipy.linalg.eigvalsh(a, b)
          np.testing.assert_array_almost_equal(w, refw)
  
      # We need to test None separatly, as otherwise DebugMode will
      # complain, as this isn't a valid ndarray.
      b = None
      B = theano.tensor.NoneConst
      f = function([A], eigvalsh(A, B))
      w = f(a)
      refw = scipy.linalg.eigvalsh(a, b)
      np.testing.assert_array_almost_equal(w, refw)
  
imports: from __future__ import absolute_import, print_function, division
  import unittest
  import numpy
  import numpy.linalg
  from numpy.testing import assert_array_almost_equal
  from numpy.testing import dec, assert_array_equal, assert_allclose
  from numpy import inf
  import itertools
  import theano
  from theano import tensor, function, grad
  from theano.tensor.basic import _allclose
  from theano.tests.test_rop import break_op
  from theano.tests import unittest_tools
  from theano import config
  from theano.tensor.slinalg import Cholesky, cholesky, CholeskyGrad, Solve, solve, Eigvalsh, EigvalshGrad, eigvalsh, expm, kron
  from theano.tests.unittest_tools import attr
  from nose.plugins.skip import SkipTest
  from nose.tools import assert_raises
label_desc: Use image node_id 8 for calling a global function with example usage: test_eigvalsh() without return types