docstr: Allow pm.Data to be used as input for other RVs.
  See https://github.com/pymc-devs/pymc/issues/3842
docstr_tok: ["Allow","pm.Data","to","be","used","as","input","for","other","RVs",".","See","https",":","\/\/github.com\/pymc-devs\/pymc\/issues\/3842"]
code: def test_shared_data_as_rv_input(self):
      """
      Allow pm.Data to be used as input for other RVs.
      See https://github.com/pymc-devs/pymc/issues/3842
      """
      with pm.Model() as m:
          x = pm.MutableData("x", [1.0, 2.0, 3.0])
          y = pm.Normal("y", mu=x, size=(2, 3))
          assert y.eval().shape == (2, 3)
          idata = pm.sample(
              chains=1,
              tune=500,
              draws=550,
              return_inferencedata=True,
              compute_convergence_checks=False,
          )
      samples = idata.posterior["y"]
      assert samples.shape == (1, 550, 2, 3)
  
      np.testing.assert_allclose(
          np.array([1.0, 2.0, 3.0]), x.get_value(), atol=1e-1
      )
      np.testing.assert_allclose(
          np.array([1.0, 2.0, 3.0]),
          samples.mean(("chain", "draw", "y_dim_0")),
          atol=1e-1,
      )
  
      with m:
          pm.set_data({"x": np.array([2.0, 4.0, 6.0])})
          assert y.eval().shape == (2, 3)
          idata = pm.sample(
              chains=1,
              tune=500,
              draws=620,
              return_inferencedata=True,
              compute_convergence_checks=False,
          )
      samples = idata.posterior["y"]
      assert samples.shape == (1, 620, 2, 3)
  
      np.testing.assert_allclose(
          np.array([2.0, 4.0, 6.0]), x.get_value(), atol=1e-1
      )
      np.testing.assert_allclose(
          np.array([2.0, 4.0, 6.0]),
          samples.mean(("chain", "draw", "y_dim_0")),
          atol=1e-1,
      )
  
imports: import io
  import itertools
  import re
  import cloudpickle
  import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  from pytensor import shared
  from pytensor.tensor.variable import TensorVariable
  import pymc
  from pymc.data import is_minibatch
  from pymc.pytensorf import GeneratorOp, floatX
label_desc: Use image node_id 7 for calling the TestData obj's underlying member method code with example usage: obj.test_shared_data_as_rv_input() without return types