code: def test_shared(self):
      # CHECK: two functions (f1 and f2) can share w
      w = shared(np.random.random((2, 2)), "w")
      wval = w.get_value(borrow=False)
  
      x = dmatrix()
      out1 = w + x
      out2 = w * x
      f1 = pfunc([x], [out1])
      f2 = pfunc([x], [out2])
      xval = np.random.random((2, 2))
      assert np.all(f1(xval) == xval + wval)
      assert np.all(f2(xval) == xval * wval)
  
      # CHECK: updating a shared value
      f3 = pfunc([x], out1, updates=[(w, (w - 1))])
      # f3 changes the value of w
      assert np.all(f3(xval) == xval + wval)
      # this same value is read by f1
      assert np.all(f1(xval) == xval + (wval - 1))
  
      w.set_value(w.get_value(borrow=True) * 10, borrow=True)
      # this same value is read by f1
      assert np.all(f1(xval) == xval + w.get_value(borrow=True))
  
imports: import numpy
  import pytest
  import pytensor.tensor
  from pytensor.compile import UnusedInputError, get_mode
  from pytensor.compile.function import function, pfunc
  from pytensor.compile.function.pfunc import rebuild_collect_shared
  from pytensor.compile.io import In
  from pytensor.compile.sharedvalue import shared
  from pytensor.configdefaults import config
  from pytensor.graph.utils import MissingInputError
  from pytensor.misc.safe_asarray import _asarray
  from pytensor.tensor.math import sum
  from pytensor.tensor.type import bscalar, bvector, dmatrices, dmatrix, dscalar, dvector, fscalar, fvector, imatrix, iscalar, ivector, ivectors, lscalar, wvector
  from pytensor.utils import PYTHON_INT_BITWIDTH
label_desc: Use image node_id 3 for calling the TestPfunc obj's underlying member method code with example usage: obj.test_shared() without return types