本文整理汇总了Python中graphs.VatxtModel方法的典型用法代码示例。如果您正苦于以下问题:Python graphs.VatxtModel方法的具体用法?Python graphs.VatxtModel怎么用?Python graphs.VatxtModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphs
的用法示例。
在下文中一共展示了graphs.VatxtModel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testClassifierGraph
# 需要导入模块: import graphs [as 别名]
# 或者: from graphs import VatxtModel [as 别名]
def testClassifierGraph(self):
FLAGS.rnn_num_layers = 2
model = graphs.VatxtModel()
train_op, _, _ = model.classifier_training()
# Pretrained vars: embedding + LSTM layers
self.assertEqual(
len(model.pretrained_variables), 1 + 2 * FLAGS.rnn_num_layers)
with self.test_session() as sess:
sess.run(tf.global_variables_initializer())
tf.train.start_queue_runners(sess)
sess.run(train_op)
示例2: testLanguageModelGraph
# 需要导入模块: import graphs [as 别名]
# 或者: from graphs import VatxtModel [as 别名]
def testLanguageModelGraph(self):
train_op, _, _ = graphs.VatxtModel().language_model_training()
with self.test_session() as sess:
sess.run(tf.global_variables_initializer())
tf.train.start_queue_runners(sess)
sess.run(train_op)
示例3: testMulticlass
# 需要导入模块: import graphs [as 别名]
# 或者: from graphs import VatxtModel [as 别名]
def testMulticlass(self):
FLAGS.num_classes = 10
graphs.VatxtModel().classifier_graph()
示例4: testATMethods
# 需要导入模块: import graphs [as 别名]
# 或者: from graphs import VatxtModel [as 别名]
def testATMethods(self):
at_methods = [None, 'rp', 'at', 'vat', 'atvat']
for method in at_methods:
FLAGS.adv_training_method = method
with tf.Graph().as_default():
graphs.VatxtModel().classifier_graph()
# Ensure variables have been reused
# Embedding + LSTM layers + hidden layers + logits layer
expected_num_vars = 1 + 2 * FLAGS.rnn_num_layers + 2 * (
FLAGS.cl_num_layers) + 2
self.assertEqual(len(tf.trainable_variables()), expected_num_vars)
示例5: testSyncReplicas
# 需要导入模块: import graphs [as 别名]
# 或者: from graphs import VatxtModel [as 别名]
def testSyncReplicas(self):
FLAGS.sync_replicas = True
graphs.VatxtModel().language_model_training()
示例6: testSeqAE
# 需要导入模块: import graphs [as 别名]
# 或者: from graphs import VatxtModel [as 别名]
def testSeqAE(self):
FLAGS.use_seq2seq_autoencoder = True
graphs.VatxtModel().language_model_training()
示例7: testEvalGraph
# 需要导入模块: import graphs [as 别名]
# 或者: from graphs import VatxtModel [as 别名]
def testEvalGraph(self):
_, _ = graphs.VatxtModel().eval_graph()