Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wux_labs
Tensorflow
提交
d5f641cb
T
Tensorflow
项目概览
wux_labs
/
Tensorflow
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d5f641cb
编写于
6月 05, 2019
作者:
P
Peter Buchlovsky
提交者:
TensorFlower Gardener
6月 05, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make MirroredStrategy throw an error when creating a trainable ReplicaLocalVariable.
PiperOrigin-RevId: 251596345
上级
f57f1ce4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
1 deletion
+27
-1
tensorflow/contrib/distribute/python/parameter_server_strategy_test.py
...ntrib/distribute/python/parameter_server_strategy_test.py
+4
-0
tensorflow/python/distribute/mirrored_strategy.py
tensorflow/python/distribute/mirrored_strategy.py
+0
-1
tensorflow/python/distribute/mirrored_strategy_test.py
tensorflow/python/distribute/mirrored_strategy_test.py
+3
-0
tensorflow/python/distribute/one_device_strategy_test.py
tensorflow/python/distribute/one_device_strategy_test.py
+3
-0
tensorflow/python/distribute/strategy_test_lib.py
tensorflow/python/distribute/strategy_test_lib.py
+17
-0
未找到文件。
tensorflow/contrib/distribute/python/parameter_server_strategy_test.py
浏览文件 @
d5f641cb
...
...
@@ -844,6 +844,10 @@ class ParameterServerStrategyTest(
num_gpus_per_worker
=
2
)
self
.
_test_all_reduce_mean_gradient_tape
(
distribution
)
def
testTrainableVariables
(
self
):
distribution
=
parameter_server_strategy
.
ParameterServerStrategy
()
self
.
_test_trainable_variable
(
distribution
)
class
ParameterServerStrategyWithChiefTest
(
ParameterServerStrategyTestBase
,
parameterized
.
TestCase
):
...
...
tensorflow/python/distribute/mirrored_strategy.py
浏览文件 @
d5f641cb
...
...
@@ -217,7 +217,6 @@ def _create_mirrored_variable(strategy, device_map, logical_device, # pylint: d
elif
synchronization
==
variable_scope
.
VariableSynchronization
.
ON_READ
:
# Variables that are to be synced on read are replica local.
is_sync_on_read
=
True
kwargs
[
"trainable"
]
=
False
elif
(
synchronization
==
variable_scope
.
VariableSynchronization
.
ON_WRITE
or
synchronization
==
variable_scope
.
VariableSynchronization
.
AUTO
):
# `AUTO` synchronization for `MirroredStrategy` is `ON_WRITE`.
...
...
tensorflow/python/distribute/mirrored_strategy_test.py
浏览文件 @
d5f641cb
...
...
@@ -226,6 +226,9 @@ class MirroredTwoDeviceDistributionTest(
def
testSummaryForReplicaZeroOnly
(
self
,
distribution
):
self
.
_test_summary_for_replica_zero_only
(
distribution
)
def
testTrainableVariables
(
self
,
distribution
):
self
.
_test_trainable_variable
(
distribution
)
def
one_device_combinations
():
return
combinations
.
combine
(
...
...
tensorflow/python/distribute/one_device_strategy_test.py
浏览文件 @
d5f641cb
...
...
@@ -110,6 +110,9 @@ class OneDeviceStrategyTest(
def
testAllReduceMeanGradientTape
(
self
,
distribution
):
self
.
_test_all_reduce_mean_gradient_tape
(
distribution
)
def
testTrainableVariables
(
self
,
distribution
):
self
.
_test_trainable_variable
(
distribution
)
@
combinations
.
generate
(
combinations
.
combine
(
...
...
tensorflow/python/distribute/strategy_test_lib.py
浏览文件 @
d5f641cb
...
...
@@ -426,6 +426,23 @@ class DistributionTestBase(test.TestCase):
with
self
.
assertRaises
(
errors
.
OutOfRangeError
):
run_and_concatenate
(
strategy
,
i
)
def
_test_trainable_variable
(
self
,
strategy
):
with
strategy
.
scope
():
v1
=
variables
.
Variable
(
1.0
)
self
.
assertEqual
(
True
,
v1
.
trainable
)
v2
=
variables
.
Variable
(
1.0
,
synchronization
=
variables
.
VariableSynchronization
.
ON_READ
)
self
.
assertEqual
(
False
,
v2
.
trainable
)
with
self
.
assertRaisesRegexp
(
ValueError
,
"Synchronization value can be set to VariableSynchronization.ON_READ "
"only for non-trainable variables"
):
_
=
variables
.
Variable
(
1.0
,
trainable
=
True
,
synchronization
=
variables
.
VariableSynchronization
.
ON_READ
)
class
OneDeviceDistributionTestBase
(
test
.
TestCase
):
"""Some tests that should work with any one-device DistributionStrategy."""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录