本文整理汇总了Python中tensorflow.contrib.distribute.python.combinations.combine函数的典型用法代码示例。如果您正苦于以下问题:Python combine函数的具体用法?Python combine怎么用?Python combine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了combine函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_times_variable_arguments
def test_times_variable_arguments(self):
c1 = combinations.combine(mode=["graph", "eager"])
c2 = combinations.combine(optimizer=["adam", "gd"])
c3 = combinations.combine(distribution=["d1", "d2"])
c4 = combinations.times(c3, c1, c2)
self.assertEqual([
OrderedDict([("distribution", "d1"), ("mode", "graph"),
("optimizer", "adam")]),
OrderedDict([("distribution", "d1"), ("mode", "graph"),
("optimizer", "gd")]),
OrderedDict([("distribution", "d1"), ("mode", "eager"),
("optimizer", "adam")]),
OrderedDict([("distribution", "d1"), ("mode", "eager"),
("optimizer", "gd")]),
OrderedDict([("distribution", "d2"), ("mode", "graph"),
("optimizer", "adam")]),
OrderedDict([("distribution", "d2"), ("mode", "graph"),
("optimizer", "gd")]),
OrderedDict([("distribution", "d2"), ("mode", "eager"),
("optimizer", "adam")]),
OrderedDict([("distribution", "d2"), ("mode", "eager"),
("optimizer", "gd")])
], c4)
self.assertEqual(
combinations.combine(
mode=["graph", "eager"],
optimizer=["adam", "gd"],
distribution=["d1", "d2"]), c4)
开发者ID:Ajaycs99,项目名称:tensorflow,代码行数:28,代码来源:combinations_test.py
示例2: test_add
def test_add(self):
self.assertEqual(
[{
"a": 1
}, {
"a": 2
}, {
"b": 2
}, {
"b": 3
}],
combinations.combine(a=[1, 2]) +
combinations.combine(b=[2, 3]))
开发者ID:Ajaycs99,项目名称:tensorflow,代码行数:13,代码来源:combinations_test.py
示例3: strategy_and_input_combinations
def strategy_and_input_combinations():
return (
combinations.times(
combinations.combine(distribution=strategies_minus_tpu),
combinations.combine(mode=['graph'],
use_numpy=[True, False],
use_validation_data=[True, False])
+ combinations.combine(mode=['eager'],
use_numpy=[False],
use_validation_data=[False])) +
combinations.times(
combinations.combine(distribution=tpu_strategies),
combinations.combine(mode=['graph'],
use_numpy=[True, False],
use_validation_data=[True, False])))
开发者ID:ziky90,项目名称:tensorflow,代码行数:15,代码来源:keras_backward_compat_test.py
示例4: test_arguments_sorted
def test_arguments_sorted(self):
self.assertEqual([
OrderedDict([("aa", 1), ("ab", 2)]),
OrderedDict([("aa", 1), ("ab", 3)]),
OrderedDict([("aa", 2), ("ab", 2)]),
OrderedDict([("aa", 2), ("ab", 3)])
], combinations.combine(ab=[2, 3], aa=[1, 2]))
开发者ID:AndreasGocht,项目名称:tensorflow,代码行数:7,代码来源:combinations_test.py
示例5: all_combinations
def all_combinations():
return combinations.combine(
distribution=[combinations.default_strategy,
combinations.one_device_strategy,
combinations.mirrored_strategy_with_gpu_and_cpu,
combinations.mirrored_strategy_with_two_gpus],
mode=["graph"])
开发者ID:becster,项目名称:tensorflow,代码行数:7,代码来源:metrics_v1_test.py
示例6: test_combinations_for_embedding_model
def test_combinations_for_embedding_model():
return (
combinations.times(
combinations.combine(distribution=
strategies_for_embedding_models()),
(graph_mode_test_configuration() +
eager_mode_test_configuration())))
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:7,代码来源:keras_correctness_test_base.py
示例7: strategy_and_optimizer_combinations
def strategy_and_optimizer_combinations():
return combinations.combine(
distribution=strategies,
optimizer=[combinations.adagrad_optimizer_v1_fn,
combinations.adam_optimizer_v1_fn,
combinations.gradient_descent_optimizer_v1_fn,
combinations.rmsprop_optimizer_v1_fn],
mode=['graph'])
开发者ID:zhaoyongke,项目名称:tensorflow,代码行数:8,代码来源:keras_test.py
示例8: test_combinations_for_stateful_embedding_model
def test_combinations_for_stateful_embedding_model():
return (
combinations.combine(
distribution=strategies_for_stateful_embedding_model(),
mode='graph',
use_numpy=False,
use_validation_data=False
))
开发者ID:AndreasGocht,项目名称:tensorflow,代码行数:8,代码来源:keras_stateful_lstm_model_correctness_test.py
示例9: strategy_and_optimizer_combinations
def strategy_and_optimizer_combinations():
return combinations.times(
all_strategy_combinations(),
combinations.combine(
optimizer=[combinations.adagrad_optimizer_v1_fn,
combinations.adam_optimizer_v1_fn,
combinations.gradient_descent_optimizer_v1_fn,
combinations.rmsprop_optimizer_v1_fn]))
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:8,代码来源:keras_backward_compat_test.py
示例10: test_combinations_with_tpu_strategies
def test_combinations_with_tpu_strategies():
tpu_strategies = [combinations.tpu_strategy,
combinations.tpu_strategy_one_step]
return (
combinations.times(
combinations.combine(distribution=tpu_strategies),
graph_mode_test_configuration()))
开发者ID:AndreasGocht,项目名称:tensorflow,代码行数:8,代码来源:keras_correctness_test_base.py
示例11: test_combine_single_parameter
def test_combine_single_parameter(self):
self.assertEqual([{
"a": 1,
"b": 2
}, {
"a": 2,
"b": 2
}], combinations.combine(a=[1, 2], b=2))
开发者ID:Ajaycs99,项目名称:tensorflow,代码行数:8,代码来源:combinations_test.py
示例12: strategy_and_input_combinations
def strategy_and_input_combinations():
def cnn_model_with_batch_norm(**kwargs):
return _create_cnn_model(with_batch_norm=True, **kwargs)
return (
combinations.times(
combinations.combine(distribution=all_strategies),
combinations.combine(mode=['graph', 'eager'],
use_numpy=[True, False],
use_validation_data=[True, False]),
combinations.combine(model_with_data=[
ModelWithData('dnn', _create_dnn_model, _dnn_training_data),
ModelWithData('cnn', _create_cnn_model, _cnn_training_data),
ModelWithData('cnn_batch_norm',
cnn_model_with_batch_norm,
_cnn_training_data,
with_batch_norm=True),
])))
开发者ID:pyjennings,项目名称:tensorflow,代码行数:18,代码来源:keras_correctness_test.py
示例13: strategy_minus_tpu_combinations
def strategy_minus_tpu_combinations():
return combinations.combine(
distribution=[combinations.default_strategy,
combinations.one_device_strategy,
combinations.mirrored_strategy_with_gpu_and_cpu,
combinations.mirrored_strategy_with_two_gpus,
combinations.core_mirrored_strategy_with_gpu_and_cpu,
combinations.core_mirrored_strategy_with_two_gpus],
mode=['graph'])
开发者ID:zhaoyongke,项目名称:tensorflow,代码行数:9,代码来源:keras_test.py
示例14: test_times
def test_times(self):
c1 = combinations.combine(mode=["graph"], loss=["callable", "tensor"])
c2 = combinations.combine(mode=["eager"], loss=["callable"])
c3 = combinations.combine(distribution=["d1", "d2"])
c4 = combinations.times(c3, c1 + c2)
self.assertEqual([
OrderedDict([("distribution", "d1"), ("loss", "callable"),
("mode", "graph")]),
OrderedDict([("distribution", "d1"), ("loss", "tensor"),
("mode", "graph")]),
OrderedDict([("distribution", "d1"), ("loss", "callable"),
("mode", "eager")]),
OrderedDict([("distribution", "d2"), ("loss", "callable"),
("mode", "graph")]),
OrderedDict([("distribution", "d2"), ("loss", "tensor"),
("mode", "graph")]),
OrderedDict([("distribution", "d2"), ("loss", "callable"),
("mode", "eager")])
], c4)
开发者ID:Ajaycs99,项目名称:tensorflow,代码行数:19,代码来源:combinations_test.py
示例15: all_strategy_combinations_minus_default
def all_strategy_combinations_minus_default():
strategy_minus_default_combinations = combinations.combine(
distribution=[
combinations.one_device_strategy,
combinations.mirrored_strategy_with_gpu_and_cpu,
combinations.mirrored_strategy_with_two_gpus,
combinations.core_mirrored_strategy_with_gpu_and_cpu,
combinations.core_mirrored_strategy_with_two_gpus],
mode=['graph', 'eager'])
return strategy_minus_default_combinations + tpu_strategy_combinations()
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:10,代码来源:keras_test.py
示例16: test_combine
def test_combine(self):
self.assertEqual([{
"a": 1,
"b": 2
}, {
"a": 1,
"b": 3
}, {
"a": 2,
"b": 2
}, {
"a": 2,
"b": 3
}], combinations.combine(a=[1, 2], b=[2, 3]))
开发者ID:Ajaycs99,项目名称:tensorflow,代码行数:14,代码来源:combinations_test.py
示例17: strategy_minus_tpu_combinations
def strategy_minus_tpu_combinations():
return combinations.combine(
distribution=strategies_minus_tpu,
mode=['graph', 'eager'])
开发者ID:ziky90,项目名称:tensorflow,代码行数:4,代码来源:keras_backward_compat_test.py
示例18: all_strategy_and_input_config_combinations
def all_strategy_and_input_config_combinations():
return (
combinations.times(
combinations.combine(distribution=all_strategies),
eager_mode_test_configuration() + graph_mode_test_configuration()))
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:5,代码来源:keras_correctness_test_base.py
示例19: graph_mode_test_configuration
def graph_mode_test_configuration():
return combinations.combine(mode='graph',
use_numpy=[True, False],
use_validation_data=[True, False])
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:4,代码来源:keras_correctness_test_base.py
示例20: eager_mode_test_configuration
def eager_mode_test_configuration():
return combinations.combine(mode='eager',
use_numpy=False,
use_validation_data=False)
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:4,代码来源:keras_correctness_test_base.py
注:本文中的tensorflow.contrib.distribute.python.combinations.combine函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论