本文整理汇总了Python中dragnn.python.bulk_component.BulkAnnotatorComponentBuilder方法的典型用法代码示例。如果您正苦于以下问题:Python bulk_component.BulkAnnotatorComponentBuilder方法的具体用法?Python bulk_component.BulkAnnotatorComponentBuilder怎么用?Python bulk_component.BulkAnnotatorComponentBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dragnn.python.bulk_component
的用法示例。
在下文中一共展示了bulk_component.BulkAnnotatorComponentBuilder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testFailsOnFixedFeature
# 需要导入模块: from dragnn.python import bulk_component [as 别名]
# 或者: from dragnn.python.bulk_component import BulkAnnotatorComponentBuilder [as 别名]
def testFailsOnFixedFeature(self):
component_spec = spec_pb2.ComponentSpec()
text_format.Parse("""
name: "annotate"
network_unit {
registered_name: "IdentityNetwork"
}
fixed_feature {
name: "fixed" embedding_dim: 32 size: 1
}
""", component_spec)
with tf.Graph().as_default():
comp = bulk_component.BulkAnnotatorComponentBuilder(
self.master, component_spec)
# Expect feature extraction to generate a runtime error due to the
# fixed feature.
with self.assertRaises(RuntimeError):
comp.build_greedy_training(self.master_state, self.network_states)
示例2: testFailsOnNonIdentityTranslator
# 需要导入模块: from dragnn.python import bulk_component [as 别名]
# 或者: from dragnn.python.bulk_component import BulkAnnotatorComponentBuilder [as 别名]
def testFailsOnNonIdentityTranslator(self):
component_spec = spec_pb2.ComponentSpec()
text_format.Parse("""
name: "test"
network_unit {
registered_name: "IdentityNetwork"
}
linked_feature {
name: "features" embedding_dim: -1 size: 1
source_translator: "history"
source_component: "mock"
}
""", component_spec)
# For feature extraction:
with tf.Graph().as_default():
comp = bulk_component.BulkFeatureExtractorComponentBuilder(
self.master, component_spec)
# Expect feature extraction to generate a error due to the "history"
# translator.
with self.assertRaises(NotImplementedError):
comp.build_greedy_training(self.master_state, self.network_states)
# As well as annotation:
with tf.Graph().as_default():
comp = bulk_component.BulkAnnotatorComponentBuilder(
self.master, component_spec)
with self.assertRaises(NotImplementedError):
comp.build_greedy_training(self.master_state, self.network_states)
示例3: testFailsOnRecurrentLinkedFeature
# 需要导入模块: from dragnn.python import bulk_component [as 别名]
# 或者: from dragnn.python.bulk_component import BulkAnnotatorComponentBuilder [as 别名]
def testFailsOnRecurrentLinkedFeature(self):
component_spec = spec_pb2.ComponentSpec()
text_format.Parse("""
name: "test"
network_unit {
registered_name: "FeedForwardNetwork"
parameters {
key: 'hidden_layer_sizes' value: '64'
}
}
linked_feature {
name: "features" embedding_dim: -1 size: 1
source_translator: "identity"
source_component: "test"
source_layer: "layer_0"
}
""", component_spec)
# For feature extraction:
with tf.Graph().as_default():
comp = bulk_component.BulkFeatureExtractorComponentBuilder(
self.master, component_spec)
# Expect feature extraction to generate a error due to the "history"
# translator.
with self.assertRaises(RuntimeError):
comp.build_greedy_training(self.master_state, self.network_states)
# As well as annotation:
with tf.Graph().as_default():
comp = bulk_component.BulkAnnotatorComponentBuilder(
self.master, component_spec)
with self.assertRaises(RuntimeError):
comp.build_greedy_training(self.master_state, self.network_states)
示例4: testFailsOnNonIdentityTranslator
# 需要导入模块: from dragnn.python import bulk_component [as 别名]
# 或者: from dragnn.python.bulk_component import BulkAnnotatorComponentBuilder [as 别名]
def testFailsOnNonIdentityTranslator(self):
component_spec = spec_pb2.ComponentSpec()
text_format.Parse("""
name: "test"
network_unit {
registered_name: "IdentityNetwork"
}
linked_feature {
name: "features" embedding_dim: -1 size: 1
source_translator: "history"
source_component: "mock"
}
""", component_spec)
# For feature extraction:
comp = bulk_component.BulkFeatureExtractorComponentBuilder(
self.master, component_spec)
# Expect feature extraction to generate a error due to the "history"
# translator.
with self.assertRaises(NotImplementedError):
comp.build_greedy_training(self.master_state, self.network_states)
# As well as annotation:
self.setUp()
comp = bulk_component.BulkAnnotatorComponentBuilder(self.master,
component_spec)
with self.assertRaises(NotImplementedError):
comp.build_greedy_training(self.master_state, self.network_states)
示例5: testFailsOnRecurrentLinkedFeature
# 需要导入模块: from dragnn.python import bulk_component [as 别名]
# 或者: from dragnn.python.bulk_component import BulkAnnotatorComponentBuilder [as 别名]
def testFailsOnRecurrentLinkedFeature(self):
component_spec = spec_pb2.ComponentSpec()
text_format.Parse("""
name: "test"
network_unit {
registered_name: "FeedForwardNetwork"
parameters {
key: 'hidden_layer_sizes' value: '64'
}
}
linked_feature {
name: "features" embedding_dim: -1 size: 1
source_translator: "identity"
source_component: "test"
source_layer: "layer_0"
}
""", component_spec)
# For feature extraction:
comp = bulk_component.BulkFeatureExtractorComponentBuilder(
self.master, component_spec)
# Expect feature extraction to generate a error due to the "history"
# translator.
with self.assertRaises(RuntimeError):
comp.build_greedy_training(self.master_state, self.network_states)
# As well as annotation:
self.setUp()
comp = bulk_component.BulkAnnotatorComponentBuilder(self.master,
component_spec)
with self.assertRaises(RuntimeError):
comp.build_greedy_training(self.master_state, self.network_states)