當前位置: 首頁>>代碼示例>>Python>>正文


Python structured_graph_builder.StructuredGraphBuilder方法代碼示例

本文整理匯總了Python中syntaxnet.structured_graph_builder.StructuredGraphBuilder方法的典型用法代碼示例。如果您正苦於以下問題:Python structured_graph_builder.StructuredGraphBuilder方法的具體用法?Python structured_graph_builder.StructuredGraphBuilder怎麽用?Python structured_graph_builder.StructuredGraphBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在syntaxnet.structured_graph_builder的用法示例。


在下文中一共展示了structured_graph_builder.StructuredGraphBuilder方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MakeGraph

# 需要導入模塊: from syntaxnet import structured_graph_builder [as 別名]
# 或者: from syntaxnet.structured_graph_builder import StructuredGraphBuilder [as 別名]
def MakeGraph(self,
                max_steps=10,
                beam_size=2,
                batch_size=1,
                **kwargs):
    """Constructs a structured learning graph."""
    assert max_steps > 0, 'Empty network not supported.'

    logging.info('MakeGraph + %s', kwargs)

    with self.test_session(graph=tf.Graph()) as sess:
      feature_sizes, domain_sizes, embedding_dims, num_actions = sess.run(
          gen_parser_ops.feature_size(task_context=self._task_context))
    embedding_dims = [8, 8, 8]
    hidden_layer_sizes = []
    learning_rate = 0.01
    builder = structured_graph_builder.StructuredGraphBuilder(
        num_actions,
        feature_sizes,
        domain_sizes,
        embedding_dims,
        hidden_layer_sizes,
        seed=1,
        max_steps=max_steps,
        beam_size=beam_size,
        gate_gradients=True,
        use_locking=True,
        use_averaging=False,
        check_parameters=False,
        **kwargs)
    builder.AddTraining(self._task_context,
                        batch_size,
                        learning_rate=learning_rate,
                        decay_steps=1000,
                        momentum=0.9,
                        corpus_name='training-corpus')
    builder.AddEvaluation(self._task_context,
                          batch_size,
                          evaluation_max_steps=25,
                          corpus_name=None)
    builder.training['inits'] = tf.group(*builder.inits.values(), name='inits')
    return builder 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:44,代碼來源:beam_reader_ops_test.py


注:本文中的syntaxnet.structured_graph_builder.StructuredGraphBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。