class_docstr: Bijector that auto-batches over both its inputs *and* any pinned values.
class_docstr_tok: ["Bijector","that","auto-batches","over","both","its","inputs","*","and","*","any","pinned","values","."]
code: def _vectorize_member_fn(self, member_fn, core_ndims):
      # Pinned values must be treated as *inputs* to vectorized bijector
      # members, since the pins can have batch dimensions that coincide
      # with the other values being transformed. For example, given
      #
      # jd = JointDistributionNamedAutoBatched({'
      #   'a': tfd.LogNormal(0., 1.),
      #   'b': lambda a: tfd.Uniform(high=a + tf.ones([3]))})
      # bij = jd.experimental_default_event_space_bijector()
      # sampled = jd.sample([2])  # ==> shape {'a': [2], 'b': [2, 3]}
      #
      # then if we pin a sampled value,
      #
      # pinned_jd = jd.experimental_pin(a=sampled['a'])
      # pinned_bij = pinned_jd.experimental_default_event_space_bijector()
      #
      # then we'd expect `pinned_bij.forward({'b': sampled['b']})` to return the
      # same value for `b` as `bij.forward(sampled)['b']`, in which
      # each of the two batch elements of `b` is transformed wrt the corresponding
      # batch element of `a`. If we used a naive _DefaultJointBijectorAutoBatched
      # instance for `pinned_bij`, we would instead get a shape error when
      # the pinned value for `a` appears in the model with batch shape `[2]`. The
      # solution is to ensure that the pinned value(s) are passed as input(s) to
      # every bijector method that we autovectorize.
      #
      # The approach implemented here uses a heavy hammer: calling any bijector
      # method rebuilds the pinned JD, creates a support bijector for its unpinned
      # values, and then invokes the requested method on that bijector.
      # (Re)creating all these Python objects incurs overhead in eager mode and
      # during `tf.function` tracing, but has no graph side effects, so repeated
      # execution of the traced function should be efficient.
      def build_and_invoke_pinned_bijector(pins, *args):
          bij = joint_distribution._DefaultJointBijector(  # pylint: disable=protected-access
              self._jd.distribution.experimental_pin(**pins),
              **self._bijector_kwargs,
          )
          return member_fn(bij, *args)
  
      vectorized_fn_of_pins = vectorization_util.make_rank_polymorphic(
          build_and_invoke_pinned_bijector,
          core_ndims=[self._pins_core_ndims] + core_ndims,
      )
      return lambda *args: vectorized_fn_of_pins(self._jd.pins, *args)
  
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import joint_distribution
  from tensorflow_probability.python.internal import docstring_util
  from tensorflow_probability.python.internal import structural_tuple
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import vectorization_util
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 for calling the _DefaultJointBijectorAutoBatchedWithPins obj's underlying member method code with example usage: obj._vectorize_member_fn(member_fn, core_ndims) and returns: function, member_fn