import tensorflow as tf

      @dynamic_batching.batch_fn
      def f(_):
        return tf.constant(1)

      output = f(tf.constant([1]))

      coord = tf.train.Coordinator()
      tf.train.start_queue_runners(coord=coord)

      with self.assertRaises(tf.errors.CancelledError):
        session.run(output)

      with self.assertRaisesRegexp(tf.errors.InvalidArgumentError,
                                   'Output shape must have a batch dimension'):
