Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
tensorflow
提交
32c11fd9
T
tensorflow
项目概览
xxadev
/
tensorflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
32c11fd9
编写于
3月 13, 2017
作者:
D
Dandelion Mané
提交者:
TensorFlower Gardener
3月 13, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix lint issues introduced by my pull from GitHub.
Change: 149985352
上级
7b8e31c5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
30 addition
and
23 deletion
+30
-23
tensorflow/contrib/layers/python/layers/layers_test.py
tensorflow/contrib/layers/python/layers/layers_test.py
+2
-2
tensorflow/contrib/slim/python/slim/learning.py
tensorflow/contrib/slim/python/slim/learning.py
+3
-3
tensorflow/examples/learn/iris.py
tensorflow/examples/learn/iris.py
+4
-1
tensorflow/python/framework/test_util.py
tensorflow/python/framework/test_util.py
+2
-1
tensorflow/python/kernel_tests/matmul_op_test.py
tensorflow/python/kernel_tests/matmul_op_test.py
+3
-2
tensorflow/python/kernel_tests/variable_scope_test.py
tensorflow/python/kernel_tests/variable_scope_test.py
+12
-11
tensorflow/python/training/monitored_session.py
tensorflow/python/training/monitored_session.py
+4
-3
未找到文件。
tensorflow/contrib/layers/python/layers/layers_test.py
浏览文件 @
32c11fd9
...
...
@@ -1709,7 +1709,7 @@ class BatchNormTest(test.TestCase):
with
self
.
test_session
():
reg
=
lambda
x
:
0.1
*
math_ops
.
reduce_sum
(
x
)
images
=
np
.
random
.
uniform
(
size
=
(
5
,
height
,
width
,
3
)).
astype
(
'f'
)
output
=
_layers
.
batch_norm
(
images
,
param_regularizers
=
{
'beta'
:
reg
})
_layers
.
batch_norm
(
images
,
param_regularizers
=
{
'beta'
:
reg
})
self
.
assertEqual
(
len
(
ops
.
get_collection
(
ops
.
GraphKeys
.
REGULARIZATION_LOSSES
)),
1
)
beta_decay
=
ops
.
get_collection
(
ops
.
GraphKeys
.
REGULARIZATION_LOSSES
)[
0
]
...
...
@@ -1720,7 +1720,7 @@ class BatchNormTest(test.TestCase):
with
self
.
test_session
():
reg
=
lambda
x
:
0.1
*
math_ops
.
reduce_sum
(
x
)
images
=
np
.
random
.
uniform
(
size
=
(
5
,
height
,
width
,
3
)).
astype
(
'f'
)
output
=
_layers
.
batch_norm
(
_layers
.
batch_norm
(
images
,
param_regularizers
=
{
'gamma'
:
reg
},
scale
=
True
)
self
.
assertEqual
(
len
(
ops
.
get_collection
(
ops
.
GraphKeys
.
REGULARIZATION_LOSSES
)),
1
)
...
...
tensorflow/contrib/slim/python/slim/learning.py
浏览文件 @
32c11fd9
...
...
@@ -18,9 +18,9 @@ This script contains various functions for training models. These include
manipulating gradients, creating a `train_op` (an operation that computes the
loss and applies the gradients) and a training loop function. The training loop
allows the user to pass in the `train_op` and runs the optimization according
to user-specified arguments. Note that the training loop uses the
tf.train.Supervisor
and its managed_session in its implementation to ensure the ability of worker
processes to recover from failures.
to user-specified arguments. Note that the training loop uses the
tf.train.Supervisor and its managed_session in its implementation to ensure the
ability of worker
processes to recover from failures.
************************************
* A simple working training script *
...
...
tensorflow/examples/learn/iris.py
浏览文件 @
32c11fd9
...
...
@@ -16,8 +16,11 @@
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
sklearn
import
model_selection
from
sklearn
import
metrics
from
sklearn
import
model_selection
import
tensorflow
as
tf
...
...
tensorflow/python/framework/test_util.py
浏览文件 @
32c11fd9
...
...
@@ -34,6 +34,7 @@ from google.protobuf import text_format
from
tensorflow.core.framework
import
graph_pb2
from
tensorflow.core.protobuf
import
config_pb2
from
tensorflow.python
import
pywrap_tensorflow
from
tensorflow.python.client
import
device_lib
from
tensorflow.python.client
import
session
from
tensorflow.python.framework
import
device
as
pydev
from
tensorflow.python.framework
import
errors
...
...
@@ -44,7 +45,6 @@ from tensorflow.python.platform import googletest
from
tensorflow.python.platform
import
tf_logging
as
logging
from
tensorflow.python.util
import
compat
from
tensorflow.python.util.protobuf
import
compare
from
tensorflow.python.client
import
device_lib
def
gpu_device_name
():
...
...
@@ -54,6 +54,7 @@ def gpu_device_name():
return
x
.
name
return
""
def
assert_ops_in_graph
(
expected_ops
,
graph
):
"""Assert all expected operations are found.
...
...
tensorflow/python/kernel_tests/matmul_op_test.py
浏览文件 @
32c11fd9
...
...
@@ -18,8 +18,8 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
numpy
as
np
import
operator
import
numpy
as
np
from
tensorflow.python.framework
import
constant_op
from
tensorflow.python.framework
import
ops
...
...
@@ -157,9 +157,10 @@ try:
# @ operator supported since python 3.5.
infix_matmul
=
operator
.
matmul
except
AttributeError
:
# For earlier versions of python, emulate regular behavior.
# Useful to build and test for 3.5+ on earlier versions.
def
infix_matmul
(
x
,
y
):
def
infix_matmul
(
x
,
y
):
# pylint: disable=invalid-name
try
:
r
=
type
(
x
).
__matmul__
(
x
,
y
)
except
AttributeError
:
...
...
tensorflow/python/kernel_tests/variable_scope_test.py
浏览文件 @
32c11fd9
...
...
@@ -723,11 +723,11 @@ class VariableScopeTest(test.TestCase):
def
testGetCollection
(
self
):
with
self
.
test_session
():
a
=
variable_scope
.
get_variable
(
"a"
,
[])
b
=
variable_scope
.
get_variable
(
"b"
,
[],
trainable
=
False
)
_
=
variable_scope
.
get_variable
(
"a"
,
[])
_
=
variable_scope
.
get_variable
(
"b"
,
[],
trainable
=
False
)
with
variable_scope
.
variable_scope
(
"foo_"
)
as
scope1
:
a
=
variable_scope
.
get_variable
(
"a"
,
[])
b
=
variable_scope
.
get_variable
(
"b"
,
[],
trainable
=
False
)
_
=
variable_scope
.
get_variable
(
"a"
,
[])
_
=
variable_scope
.
get_variable
(
"b"
,
[],
trainable
=
False
)
self
.
assertEqual
([
v
.
name
for
v
in
scope1
.
get_collection
(
ops
.
GraphKeys
.
TRAINABLE_VARIABLES
)
...
...
@@ -737,8 +737,8 @@ class VariableScopeTest(test.TestCase):
for
v
in
scope1
.
get_collection
(
ops
.
GraphKeys
.
GLOBAL_VARIABLES
)
],
[
"foo_/a:0"
,
"foo_/b:0"
])
with
variable_scope
.
variable_scope
(
"foo"
)
as
scope2
:
a
=
variable_scope
.
get_variable
(
"a"
,
[])
b
=
variable_scope
.
get_variable
(
"b"
,
[],
trainable
=
False
)
_
=
variable_scope
.
get_variable
(
"a"
,
[])
_
=
variable_scope
.
get_variable
(
"b"
,
[],
trainable
=
False
)
self
.
assertEqual
([
v
.
name
for
v
in
scope2
.
get_collection
(
ops
.
GraphKeys
.
TRAINABLE_VARIABLES
)
...
...
@@ -758,21 +758,22 @@ class VariableScopeTest(test.TestCase):
def
testGetTrainableVariables
(
self
):
with
self
.
test_session
():
a
=
variable_scope
.
get_variable
(
"a"
,
[])
_
=
variable_scope
.
get_variable
(
"a"
,
[])
with
variable_scope
.
variable_scope
(
"foo"
)
as
scope
:
b
=
variable_scope
.
get_variable
(
"b"
,
[])
c
=
variable_scope
.
get_variable
(
"c"
,
[],
trainable
=
False
)
_
=
variable_scope
.
get_variable
(
"b"
,
[])
_
=
variable_scope
.
get_variable
(
"c"
,
[],
trainable
=
False
)
self
.
assertEqual
([
v
.
name
for
v
in
scope
.
trainable_variables
()],
[
"foo/b:0"
])
def
testGetGlobalVariables
(
self
):
with
self
.
test_session
():
a
=
variable_scope
.
get_variable
(
"a"
,
[])
_
=
variable_scope
.
get_variable
(
"a"
,
[])
with
variable_scope
.
variable_scope
(
"foo"
)
as
scope
:
b
=
variable_scope
.
get_variable
(
"b"
,
[])
_
=
variable_scope
.
get_variable
(
"b"
,
[])
self
.
assertEqual
([
v
.
name
for
v
in
scope
.
global_variables
()],
[
"foo/b:0"
])
def
axis0_into1_partitioner
(
shape
=
None
,
**
unused_kwargs
):
part
=
[
1
]
*
len
(
shape
)
return
part
...
...
tensorflow/python/training/monitored_session.py
浏览文件 @
32c11fd9
...
...
@@ -67,8 +67,8 @@ class Scaffold(object):
The following pieces are directly accessible as attributes of the `Scaffold`
object:
* `saver`: A `tf.train.Saver` object taking care of saving the variables.
Picked
from and stored into the `SAVERS` collection in the graph by default.
* `saver`: A `tf.train.Saver` object taking care of saving the variables.
Picked
from and stored into the `SAVERS` collection in the graph by default.
* `init_op`: An op to run to initialize the variables. Picked from and
stored into the `INIT_OP` collection in the graph by default.
* `ready_op`: An op to verify that the variables are initialized. Picked
...
...
@@ -124,7 +124,8 @@ class Scaffold(object):
local_init_op: Optional op to initialize local variables.
summary_op: Optional op to gather all summaries. Must return a scalar
string tensor containing a serialized `Summary` proto.
saver: Optional `tf.train.Saver` object to use to save and restore variables.
saver: Optional `tf.train.Saver` object to use to save and restore
variables.
"""
# NOTE(touts): modifying the init function to be passed the scaffold is a
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录