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


Python component.NetworkState方法代碼示例

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


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

示例1: testBulkFeatureIdExtractorOkWithOneFixedFeature

# 需要導入模塊: from dragnn.python import component [as 別名]
# 或者: from dragnn.python.component import NetworkState [as 別名]
def testBulkFeatureIdExtractorOkWithOneFixedFeature(self):
    component_spec = spec_pb2.ComponentSpec()
    text_format.Parse("""
        name: "test"
        network_unit {
          registered_name: "IdentityNetwork"
        }
        fixed_feature {
          name: "fixed" embedding_dim: -1 size: 1
        }
        """, component_spec)
    with tf.Graph().as_default():
      comp = bulk_component.BulkFeatureIdExtractorComponentBuilder(
          self.master, component_spec)

      # Should not raise errors.
      self.network_states[component_spec.name] = component.NetworkState()
      comp.build_greedy_training(self.master_state, self.network_states)
      self.network_states[component_spec.name] = component.NetworkState()
      comp.build_greedy_inference(self.master_state, self.network_states) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:22,代碼來源:bulk_component_test.py

示例2: testBulkFeatureIdExtractorOkWithOneFixedFeature

# 需要導入模塊: from dragnn.python import component [as 別名]
# 或者: from dragnn.python.component import NetworkState [as 別名]
def testBulkFeatureIdExtractorOkWithOneFixedFeature(self):
    component_spec = spec_pb2.ComponentSpec()
    text_format.Parse("""
        name: "test"
        network_unit {
          registered_name: "IdentityNetwork"
        }
        fixed_feature {
          name: "fixed" embedding_dim: -1 size: 1
        }
        """, component_spec)
    comp = bulk_component.BulkFeatureIdExtractorComponentBuilder(
        self.master, component_spec)

    # Should not raise errors.
    self.network_states[component_spec.name] = component.NetworkState()
    comp.build_greedy_training(self.master_state, self.network_states)
    self.network_states[component_spec.name] = component.NetworkState()
    comp.build_greedy_inference(self.master_state, self.network_states) 
開發者ID:generalized-iou,項目名稱:g-tensorflow-models,代碼行數:21,代碼來源:bulk_component_test.py

示例3: testBulkFeatureIdExtractorOkWithMultipleFixedFeatures

# 需要導入模塊: from dragnn.python import component [as 別名]
# 或者: from dragnn.python.component import NetworkState [as 別名]
def testBulkFeatureIdExtractorOkWithMultipleFixedFeatures(self):
    component_spec = spec_pb2.ComponentSpec()
    text_format.Parse("""
        name: "test"
        network_unit {
          registered_name: "IdentityNetwork"
        }
        fixed_feature {
          name: "fixed1" embedding_dim: -1 size: 1
        }
        fixed_feature {
          name: "fixed2" embedding_dim: -1 size: 1
        }
        fixed_feature {
          name: "fixed3" embedding_dim: -1 size: 1
        }
        """, component_spec)
    comp = bulk_component.BulkFeatureIdExtractorComponentBuilder(
        self.master, component_spec)

    # Should not raise errors.
    self.network_states[component_spec.name] = component.NetworkState()
    comp.build_greedy_training(self.master_state, self.network_states)
    self.network_states[component_spec.name] = component.NetworkState()
    comp.build_greedy_inference(self.master_state, self.network_states) 
開發者ID:generalized-iou,項目名稱:g-tensorflow-models,代碼行數:27,代碼來源:bulk_component_test.py

示例4: build_inference

# 需要導入模塊: from dragnn.python import component [as 別名]
# 或者: from dragnn.python.component import NetworkState [as 別名]
def build_inference(self, handle, use_moving_average=False):
    """Builds an inference pipeline.

    This always uses the whole pipeline.

    Args:
      handle: Handle tensor for the ComputeSession.
      use_moving_average: Whether or not to read from the moving
        average variables instead of the true parameters. Note: it is not
        possible to make gradient updates when this is True.

    Returns:
      handle: Handle after annotation.
    """
    self.read_from_avg = use_moving_average
    network_states = {}

    for comp in self.components:
      network_states[comp.name] = component.NetworkState()
      handle = dragnn_ops.init_component_data(
          handle, beam_size=comp.inference_beam_size, component=comp.name)
      master_state = component.MasterState(handle,
                                           dragnn_ops.batch_size(
                                               handle, component=comp.name))
      with tf.control_dependencies([handle]):
        handle = comp.build_greedy_inference(master_state, network_states)
      handle = dragnn_ops.write_annotations(handle, component=comp.name)

    self.read_from_avg = False
    return handle 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:32,代碼來源:graph_builder.py

示例5: setUp

# 需要導入模塊: from dragnn.python import component [as 別名]
# 或者: from dragnn.python.component import NetworkState [as 別名]
def setUp(self):
    self.master = MockMaster()
    self.master_state = component.MasterState(
        handle='handle', current_batch_size=2)
    self.network_states = {
        'mock': component.NetworkState(),
        'test': component.NetworkState(),
    } 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:10,代碼來源:bulk_component_test.py

示例6: testBulkFeatureIdExtractorOkWithMultipleFixedFeatures

# 需要導入模塊: from dragnn.python import component [as 別名]
# 或者: from dragnn.python.component import NetworkState [as 別名]
def testBulkFeatureIdExtractorOkWithMultipleFixedFeatures(self):
    component_spec = spec_pb2.ComponentSpec()
    text_format.Parse("""
        name: "test"
        network_unit {
          registered_name: "IdentityNetwork"
        }
        fixed_feature {
          name: "fixed1" embedding_dim: -1 size: 1
        }
        fixed_feature {
          name: "fixed2" embedding_dim: -1 size: 1
        }
        fixed_feature {
          name: "fixed3" embedding_dim: -1 size: 1
        }
        """, component_spec)
    with tf.Graph().as_default():
      comp = bulk_component.BulkFeatureIdExtractorComponentBuilder(
          self.master, component_spec)

      # Should not raise errors.
      self.network_states[component_spec.name] = component.NetworkState()
      comp.build_greedy_training(self.master_state, self.network_states)
      self.network_states[component_spec.name] = component.NetworkState()
      comp.build_greedy_inference(self.master_state, self.network_states) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:28,代碼來源:bulk_component_test.py


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