import tensorflow as tf


      @dynamic_batching.batch_fn
      def f(a):
        return a

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

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

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

      with self.assertRaises(tf.errors.CancelledError):
