import tensorflow as tf

  def testStrippedOpListDef(self):
    with self.test_session():
      # Creates a graph.
      v0 = tf.Variable(0.0)
      var = tf.Variable(10.0)
      tf.add(v0, var)
      @function.Defun(x=tf.float32)
      def minus_one(x):
        return x - 1
      minus_one(tf.identity(v0))
      save = tf.train.Saver({"v0": v0})
      tf.initialize_all_variables()

      # Generates MetaGraphDef.
      meta_graph_def = save.export_meta_graph()
      ops = [o.name for o in meta_graph_def.meta_info_def.stripped_op_list.op]
      self.assertEqual(ops, ["Add", "Assign", "Const", "Identity", "NoOp",
                             "RestoreSlice", "SaveSlices", "Sub", "Variable"])


if __name__ == "__main__":
  tf.test.main()
