docstr: This test is related to https://github.com/pymc-devs/pytensor/issues/390 which breaks
  broadcastability of column-vector RVs. This unexpected change in type can lead to
  incompatibilities during graph rewriting for model.logp evaluation.
docstr_tok: ["This","test","is","related","to","https",":","\/\/github.com\/pymc-devs\/pytensor\/issues\/390","which","breaks","broadcastability","of","column-vector","RVs",".","This","unexpected","change","in","type","can","lead","to","incompatibilities","during","graph","rewriting","for","model.logp","evaluation","."]
code: def test_observed_with_column_vector(self):
      """This test is related to https://github.com/pymc-devs/pytensor/issues/390 which breaks
      broadcastability of column-vector RVs. This unexpected change in type can lead to
      incompatibilities during graph rewriting for model.logp evaluation.
      """
      with pm.Model() as model:
          # The `observed` is a broadcastable column vector
          obs = [
              pt.as_tensor_variable(
                  np.ones((3, 1), dtype=pytensor.config.floatX)
              )
              for _ in range(4)
          ]
          assert all(
              obs_.broadcastable == (False, True) for obs_ in obs
          )
  
          # Both shapes describe broadcastable volumn vectors
          size64 = pt.constant([3, 1], dtype="int64")
          # But the second shape is upcasted from an int32 vector
          cast64 = pt.cast(
              pt.constant([3, 1], dtype="int32"), dtype="int64"
          )
  
          pm.Normal(
              "size64", mu=0, sigma=1, size=size64, observed=obs[0]
          )
          pm.Normal(
              "shape64", mu=0, sigma=1, shape=size64, observed=obs[1]
          )
          assert model.compile_logp()({})
  
          pm.Normal(
              "size_cast64", mu=0, sigma=1, size=cast64, observed=obs[2]
          )
          pm.Normal(
              "shape_cast64",
              mu=0,
              sigma=1,
              shape=cast64,
              observed=obs[3],
          )
          assert model.compile_logp()({})
  
imports: import re
  import warnings
  import numpy
  import pytensor
  import pytest
  from pytensor import tensor
  from pytensor.compile.mode import Mode
  from pytensor.graph import Constant, ancestors
  from pytensor.tensor import TensorVariable
  from pytensor.tensor.random import normal
  from pytensor.tensor.shape import SpecifyShape
  import pymc
  from pymc import ShapeError
  from pymc.distributions.shape_utils import broadcast_dist_samples_shape, change_dist_size, convert_dims, convert_shape, convert_size, get_support_shape, get_support_shape_1d, rv_size_is_none, to_tuple
  from pymc.model import Model
label_desc: Use image node_id 10 for calling the TestSizeShapeDimsObserved obj's underlying member method code with example usage: obj.test_observed_with_column_vector() without return types