code: def get_scaling(
      total_size: Sequence[Variable], shape: TensorVariable
  ) -> TensorVariable:
      """Gets scaling constant for logp."""
  
      # mypy doesn't understand we can convert a shape TensorVariable into a tuple
      shape = tuple(shape)  # type: ignore
  
      # Scalar RV
      if len(shape) == 0:  # type: ignore
          coef = (
              total_size[0]
              if not NoneConst.equals(total_size[0])
              else 1.0
          )
      else:
          coefs = [
              t / shape[i]
              for i, t in enumerate(total_size)
              if not NoneConst.equals(t)
          ]
          coef = pt.prod(coefs)
  
      return pt.cast(coef, dtype=config.floatX)
  
file_path: pymc/pymc/variational/minibatch_rv.py
imports: from typing import Any, Sequence, Union, cast
  import pytensor.tensor
  from pytensor import Variable, config
  from pytensor.graph import Apply, Op
  from pytensor.tensor import NoneConst, TensorVariable, as_tensor_variable
  from pymc.logprob.abstract import MeasurableVariable, _logprob, _logprob_helper
label_desc: Use image node_id 2 for calling a global function with example usage: get_scaling(total_size, shape) and returns: pt