from tensorflow.python.framework import ops

      x: `Tensor`.
      name: `String`. The name to give this op.

    Returns:
      x: `Tensor`. Input transposed/reshaped to `B_+E_+S_`.
      sample_shape: `Tensor` (1D, `int32`).
    """
    with self._name_scope(name, values=[x]):
      x = ops.convert_to_tensor(x, name="x")
      sample_shape, batch_shape, event_shape = self.get_shape(x)
      event_shape = distribution_util.pick_vector(
          self._event_ndims_is_0, (1,), event_shape)
      batch_shape = distribution_util.pick_vector(
          self._batch_ndims_is_0, (1,), batch_shape)
      new_shape = array_ops.concat(0, ((-1,), batch_shape, event_shape))
      x = array_ops.reshape(x, shape=new_shape)
