import tensorflow as tf


  # NOTE(mrry): See also
  #   dense_update_ops_no_tsan_test.AssignOpTest, which contains a benign
  #   data race and must run without TSAN.
  def testParallelUpdateWithLocking(self):
    with self.test_session() as sess:
      zeros_t = tf.fill([1024, 1024], 0.0)
      ones_t = tf.fill([1024, 1024], 1.0)
      p = tf.Variable(zeros_t)
      adds = [tf.assign_add(p, ones_t, use_locking=True)
              for _ in range(20)]
      p.initializer.run()

      def run_add(add_op):
        sess.run(add_op)
      threads = [
          self.checkedThread(target=run_add, args=(add_op,)) for add_op in adds]
      for t in threads:
