code: def test_cholesky_and_cholesky_grad_shape():
      if not imported_scipy:
          raise SkipTest("Scipy needed for the Cholesky op.")
  
      rng = np.random.RandomState(utt.fetch_seed())
      x = tensor.matrix()
      for l in (
          cholesky(x),
          Cholesky(lower=True)(x),
          Cholesky(lower=False)(x),
      ):
          f_chol = theano.function([x], l.shape)
          g = tensor.grad(l.sum(), x)
          f_cholgrad = theano.function([x], g.shape)
          topo_chol = f_chol.maker.fgraph.toposort()
          topo_cholgrad = f_cholgrad.maker.fgraph.toposort()
          if config.mode != "FAST_COMPILE":
              assert (
                  sum(
                      [
                          node.op.__class__ == Cholesky
                          for node in topo_chol
                      ]
                  )
                  == 0
              )
              assert (
                  sum(
                      [
                          node.op.__class__ == CholeskyGrad
                          for node in topo_cholgrad
                      ]
                  )
                  == 0
              )
          for shp in [2, 3, 5]:
              m = np.cov(rng.randn(shp, shp + 10)).astype(config.floatX)
              yield np.testing.assert_equal, f_chol(m), (shp, shp)
              yield np.testing.assert_equal, f_cholgrad(m), (shp, shp)
  
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 7 for calling a global function with example usage: test_cholesky_and_cholesky_grad_shape() without return types