code: def test_shared_mutable(self):
      bval = np.arange(5)
      b = shared(bval)
      b_out = b * 2
  
      # shared vars copy args.
      assert b.get_value(borrow=True) is not bval
      # so we do this to get at the underlying data
      bval = data_of(b)
  
      # by default, shared are not mutable unless doing an explicit update
      f = pfunc([], [b_out], mode="FAST_RUN")
      assert (f() == np.arange(5) * 2).all()
      assert np.all(b.get_value(borrow=True) == np.arange(5))
  
      # using updates, b is now a mutable parameter
      f = pfunc([], [b_out], updates=[(b, b_out)], mode="FAST_RUN")
      assert (f() == (np.arange(5) * 2)).all()
      # because of the update
      assert (b.get_value(borrow=True) == (np.arange(5) * 2)).all()
      assert (
          bval == (np.arange(5) * 2)
      ).all()  # because of mutable=True
  
      # do not depend on updates being in-place though!
      bval = np.arange(5)
      b.set_value(bval, borrow=True)
      bval = data_of(b)
      f = pfunc(
          [], [b_out], updates=[(b, (b_out + 3))], mode="FAST_RUN"
      )
      assert (f() == (np.arange(5) * 2)).all()
      # because of the update
      assert (
          b.get_value(borrow=True) == ((np.arange(5) * 2) + 3)
      ).all()
      # bval got modified to something...
      assert not (bval == np.arange(5)).all()
      # ... but not to b.value !
      assert not (bval == b.get_value(borrow=True)).all()
  
imports: from __future__ import absolute_import, print_function, division
  import unittest
  from nose.plugins.skip import SkipTest
  import numpy
  import theano
  from theano.tensor import dmatrix, iscalar, lscalar, dmatrices
  from theano import tensor
  from theano.compile import In
  from theano.compile import pfunc
  from theano.compile import shared
  from theano.compile import config
label_desc: Use image node_id 8 for calling the Test_pfunc obj's underlying member method code with example usage: obj.test_shared_mutable() without return types