code: def test_solve_correctness(self):
      if not imported_scipy:
          raise SkipTest("Scipy needed for the Cholesky and Solve ops.")
      rng = np.random.RandomState(utt.fetch_seed())
      A = theano.tensor.matrix()
      b = theano.tensor.matrix()
      y = self.op(A, b)
      gen_solve_func = theano.function([A, b], y)
  
      cholesky_lower = Cholesky(lower=True)
      L = cholesky_lower(A)
      y_lower = self.op(L, b)
      lower_solve_func = theano.function([L, b], y_lower)
  
      cholesky_upper = Cholesky(lower=False)
      U = cholesky_upper(A)
      y_upper = self.op(U, b)
      upper_solve_func = theano.function([U, b], y_upper)
  
      b_val = np.asarray(rng.rand(5, 1), dtype=config.floatX)
  
      # 1-test general case
      A_val = np.asarray(rng.rand(5, 5), dtype=config.floatX)
      # positive definite matrix:
      A_val = np.dot(A_val.transpose(), A_val)
      assert np.allclose(
          scipy.linalg.solve(A_val, b_val), gen_solve_func(A_val, b_val)
      )
  
      # 2-test lower traingular case
      L_val = scipy.linalg.cholesky(A_val, lower=True)
      assert np.allclose(
          scipy.linalg.solve_triangular(L_val, b_val, lower=True),
          lower_solve_func(L_val, b_val),
      )
  
      # 3-test upper traingular case
      U_val = scipy.linalg.cholesky(A_val, lower=False)
      assert np.allclose(
          scipy.linalg.solve_triangular(U_val, b_val, lower=False),
          upper_solve_func(U_val, b_val),
      )
  
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 3 for calling the test_Solve obj's underlying member method code with example usage: obj.test_solve_correctness() without return types