code: def transformed_value_logprob(
      op, values, *rv_outs, use_jacobian=True, **kwargs
  ):
      """Compute the log-probability graph for a `TransformedRV`.
  
      This is introduced by the `TransformValuesRewrite`
      """
      rv_op = rv_outs[0].owner.op
      rv_inputs = rv_outs[0].owner.inputs
      logprobs = _logprob(rv_op, values, *rv_inputs, **kwargs)
  
      if not isinstance(logprobs, Sequence):
          logprobs = [logprobs]
  
      # Handle jacobian
      assert len(values) == len(logprobs) == len(op.transforms)
      logprobs_jac = []
      for value, transform, logp in zip(
          values, op.transforms, logprobs
      ):
          if transform is None:
              logprobs_jac.append(logp)
              continue
  
          assert isinstance(value.owner.op, TransformedValue)
          original_forward_value = value.owner.inputs[1]
          log_jac_det = transform.log_jac_det(
              original_forward_value, *rv_inputs
          ).copy()
          # The jacobian determinant has less dims than the logp
          # when a multivariate transform (like Simplex or Ordered) is applied to univariate distributions.
          # In this case we have to reduce the last logp dimensions, as they are no longer independent
          if log_jac_det.ndim < logp.ndim:
              diff_ndims = logp.ndim - log_jac_det.ndim
              logp = logp.sum(axis=np.arange(-diff_ndims, 0))
          # This case is sometimes, but not always, trivial to accomodate depending on the "space rank" of the
          # multivariate distribution. See https://proceedings.mlr.press/v130/radul21a.html
          elif log_jac_det.ndim > logp.ndim:
              raise NotImplementedError(
                  f"Univariate transform {transform} cannot be applied to multivariate {rv_op}"
              )
          # Check there is no broadcasting between logp and jacobian
          if logp.type.broadcastable != log_jac_det.type.broadcastable:
              raise ValueError(
                  f"The logp of {rv_op} and log_jac_det of {transform} are not allowed to broadcast together. "
                  "There is a bug in the implementation of either one."
              )
  
          if use_jacobian:
              if value.name:
                  log_jac_det.name = f"{value.name}_jacobian"
              logprobs_jac.append(logp + log_jac_det)
          else:
              # We still want to use the reduced logp, even though the jacobian isn't included
              logprobs_jac.append(logp)
  
      return logprobs_jac
  
imports: from typing import Dict, Optional, Sequence, Union
  import numpy
  from pytensor.gradient import DisconnectedType
  from pytensor.graph import Apply, Op
  from pytensor.graph.features import AlreadyThere, Feature
  from pytensor.graph.fg import FunctionGraph
  from pytensor.graph.replace import clone_replace
  from pytensor.graph.rewriting.basic import GraphRewriter, in2out, node_rewriter
  from pytensor.scan.op import Scan
  from pytensor.tensor.variable import TensorVariable
  from pymc.logprob.abstract import MeasurableVariable, _logprob
  from pymc.logprob.rewriting import PreserveRVMappings, cleanup_ir_rewrites_db
  from pymc.logprob.transforms import Transform
label_desc: Use image node_id 1 for calling a global function with example usage: transformed_value_logprob(op, values) and returns: logprobs_jac