Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
tensorflow
提交
10f23637
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,发现更多精彩内容 >>
提交
10f23637
编写于
12月 22, 2015
作者:
V
Vijay Vasudevan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some lint errors in image_ops_test.py and word2vec_basic.py
Change: 110727357
上级
fc4063af
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
124 addition
and
146 deletion
+124
-146
README.md
README.md
+3
-34
tensorflow/core/BUILD
tensorflow/core/BUILD
+1
-0
tensorflow/core/kernels/resize_area_op.cc
tensorflow/core/kernels/resize_area_op.cc
+2
-5
tensorflow/core/kernels/resize_bicubic_op.cc
tensorflow/core/kernels/resize_bicubic_op.cc
+2
-5
tensorflow/core/kernels/resize_bilinear_op.cc
tensorflow/core/kernels/resize_bilinear_op.cc
+2
-5
tensorflow/core/kernels/resize_nearest_neighbor_op.cc
tensorflow/core/kernels/resize_nearest_neighbor_op.cc
+2
-5
tensorflow/core/ops/image_ops.cc
tensorflow/core/ops/image_ops.cc
+4
-4
tensorflow/core/ops/ops.pbtxt
tensorflow/core/ops/ops.pbtxt
+8
-0
tensorflow/examples/tutorials/word2vec/word2vec_basic.py
tensorflow/examples/tutorials/word2vec/word2vec_basic.py
+12
-10
tensorflow/g3doc/api_docs/python/framework.md
tensorflow/g3doc/api_docs/python/framework.md
+1
-1
tensorflow/g3doc/resources/dims_types.md
tensorflow/g3doc/resources/dims_types.md
+5
-5
tensorflow/g3doc/tutorials/deep_cnn/index.md
tensorflow/g3doc/tutorials/deep_cnn/index.md
+1
-1
tensorflow/python/framework/ops.py
tensorflow/python/framework/ops.py
+1
-1
tensorflow/python/ops/image_ops_test.py
tensorflow/python/ops/image_ops_test.py
+74
-65
tensorflow/python/ops/template.py
tensorflow/python/ops/template.py
+1
-1
tensorflow/python/training/coordinator.py
tensorflow/python/training/coordinator.py
+4
-4
tensorflow/stream_executor/BUILD
tensorflow/stream_executor/BUILD
+1
-0
未找到文件。
README.md
浏览文件 @
10f23637
...
...
@@ -16,11 +16,8 @@ organization for the purposes of conducting machine learning and deep neural
networks research. The system is general enough to be applicable in a wide
variety of other domains, as well.
**
Note: Currently we do not accept pull requests on github -- see
[
CONTRIBUTING.md
](
CONTRIBUTING.md
)
for information on how to contribute code
changes to TensorFlow through
[
tensorflow.googlesource.com
](
https://tensorflow.googlesource.com/tensorflow
)
**
**
If you'd like to contribute to tensorflow, be sure to review the
[
contribution
guidelines
](
CONTRIBUTING.md
)
.
**
**
We use
[
github issues
](
https://github.com/tensorflow/tensorflow/issues
)
for
tracking requests and bugs, but please see
...
...
@@ -29,35 +26,7 @@ and discussion.**
# Download and Setup
To install the CPU version of TensorFlow using a binary package, see the
instructions below. For more detailed installation instructions, including
installing from source, GPU-enabled support, etc., see
[
here
](
tensorflow/g3doc/get_started/os_setup.md
)
.
## Binary Installation
The TensorFlow Python API supports Python 2.7 and Python 3.3+.
The simplest way to install TensorFlow is using
[
pip
](
https://pypi.python.org/pypi/pip
)
for both Linux and Mac.
For the GPU-enabled version, or if you encounter installation errors, or for
more detailed installation instructions, see
[
here
](
tensorflow/g3doc/get_started/os_setup.md#detailed_install
)
.
### Ubuntu/Linux 64-bit
```
bash
# For CPU-only version
$
pip
install
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl
```
### Mac OS X
```
bash
# Only CPU-version is available at the moment.
$
pip
install
https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
```
See
[
install instructions
](
tensorflow/g3doc/get_started/os_setup.md
)
.
### Try your first TensorFlow program
...
...
tensorflow/core/BUILD
浏览文件 @
10f23637
...
...
@@ -349,6 +349,7 @@ tf_gpu_kernel_library(
visibility
=
[
"//visibility:public"
],
deps
=
[
":cuda"
,
":framework"
,
"//third_party/eigen3"
,
],
)
...
...
tensorflow/core/kernels/resize_area_op.cc
浏览文件 @
10f23637
...
...
@@ -144,11 +144,8 @@ class ResizeAreaOp : public OpKernel {
.HostMemory("size"), \
ResizeAreaOp<CPUDevice, T>);
REGISTER_KERNEL
(
uint8
);
REGISTER_KERNEL
(
int8
);
REGISTER_KERNEL
(
int32
);
REGISTER_KERNEL
(
float
);
REGISTER_KERNEL
(
double
);
TF_CALL_REAL_NUMBER_TYPES
(
REGISTER_KERNEL
);
#undef REGISTER_KERNEL
}
// namespace tensorflow
tensorflow/core/kernels/resize_bicubic_op.cc
浏览文件 @
10f23637
...
...
@@ -131,11 +131,8 @@ class ResizeBicubicOp : public OpKernel {
.HostMemory("size"), \
ResizeBicubicOp<CPUDevice, T>);
REGISTER_KERNEL
(
uint8
);
REGISTER_KERNEL
(
int8
);
REGISTER_KERNEL
(
int32
);
REGISTER_KERNEL
(
float
);
REGISTER_KERNEL
(
double
);
TF_CALL_REAL_NUMBER_TYPES
(
REGISTER_KERNEL
);
#undef REGISTER_KERNEL
}
// namespace tensorflow
tensorflow/core/kernels/resize_bilinear_op.cc
浏览文件 @
10f23637
...
...
@@ -215,11 +215,8 @@ class ResizeBilinearOpGrad : public OpKernel {
.HostMemory("size"), \
ResizeBilinearOp<CPUDevice, T>);
REGISTER_KERNEL
(
uint8
);
REGISTER_KERNEL
(
int8
);
REGISTER_KERNEL
(
int32
);
REGISTER_KERNEL
(
float
);
REGISTER_KERNEL
(
double
);
TF_CALL_REAL_NUMBER_TYPES
(
REGISTER_KERNEL
);
#undef REGISTER_KERNEL
REGISTER_KERNEL_BUILDER
(
Name
(
"ResizeBilinearGrad"
)
...
...
tensorflow/core/kernels/resize_nearest_neighbor_op.cc
浏览文件 @
10f23637
...
...
@@ -178,11 +178,8 @@ class ResizeNearestNeighborOpGrad : public OpKernel {
.HostMemory("size"), \
ResizeNearestNeighborOpGrad<CPUDevice, T>);
REGISTER_KERNEL
(
uint8
);
REGISTER_KERNEL
(
int8
);
REGISTER_KERNEL
(
int32
);
REGISTER_KERNEL
(
float
);
REGISTER_KERNEL
(
double
);
TF_CALL_REAL_NUMBER_TYPES
(
REGISTER_KERNEL
);
#undef REGISTER_KERNEL
}
// namespace tensorflow
tensorflow/core/ops/image_ops.cc
浏览文件 @
10f23637
...
...
@@ -22,7 +22,7 @@ REGISTER_OP("ResizeArea")
.
Input
(
"images: T"
)
.
Input
(
"size: int32"
)
.
Output
(
"resized_images: float"
)
.
Attr
(
"T: {uint8, int8, int
32
, float, double}"
)
.
Attr
(
"T: {uint8, int8, int
16, int32, int64
, float, double}"
)
.
Doc
(
R"doc(
Resize `images` to `size` using area interpolation.
...
...
@@ -40,7 +40,7 @@ REGISTER_OP("ResizeBicubic")
.
Input
(
"images: T"
)
.
Input
(
"size: int32"
)
.
Output
(
"resized_images: float"
)
.
Attr
(
"T: {uint8, int8, int
32
, float, double}"
)
.
Attr
(
"T: {uint8, int8, int
16, int32, int64
, float, double}"
)
.
Doc
(
R"doc(
Resize `images` to `size` using bicubic interpolation.
...
...
@@ -58,7 +58,7 @@ REGISTER_OP("ResizeBilinear")
.
Input
(
"images: T"
)
.
Input
(
"size: int32"
)
.
Output
(
"resized_images: float"
)
.
Attr
(
"T: {uint8, int8, int
32
, float, double}"
)
.
Attr
(
"T: {uint8, int8, int
16, int32, int64
, float, double}"
)
.
Doc
(
R"doc(
Resize `images` to `size` using bilinear interpolation.
...
...
@@ -93,7 +93,7 @@ REGISTER_OP("ResizeNearestNeighbor")
.
Input
(
"images: T"
)
.
Input
(
"size: int32"
)
.
Output
(
"resized_images: T"
)
.
Attr
(
"T: {uint8, int8, int
32
, float, double}"
)
.
Attr
(
"T: {uint8, int8, int
16, int32, int64
, float, double}"
)
.
Doc
(
R"doc(
Resize `images` to `size` using nearest neighbor interpolation.
...
...
tensorflow/core/ops/ops.pbtxt
浏览文件 @
10f23637
...
...
@@ -5949,7 +5949,9 @@ op {
list {
type: DT_UINT8
type: DT_INT8
type: DT_INT16
type: DT_INT32
type: DT_INT64
type: DT_FLOAT
type: DT_DOUBLE
}
...
...
@@ -5982,7 +5984,9 @@ op {
list {
type: DT_UINT8
type: DT_INT8
type: DT_INT16
type: DT_INT32
type: DT_INT64
type: DT_FLOAT
type: DT_DOUBLE
}
...
...
@@ -6015,7 +6019,9 @@ op {
list {
type: DT_UINT8
type: DT_INT8
type: DT_INT16
type: DT_INT32
type: DT_INT64
type: DT_FLOAT
type: DT_DOUBLE
}
...
...
@@ -6077,7 +6083,9 @@ op {
list {
type: DT_UINT8
type: DT_INT8
type: DT_INT16
type: DT_INT32
type: DT_INT64
type: DT_FLOAT
type: DT_DOUBLE
}
...
...
tensorflow/examples/tutorials/word2vec/word2vec_basic.py
浏览文件 @
10f23637
...
...
@@ -141,16 +141,18 @@ with graph.as_default():
train_labels
=
tf
.
placeholder
(
tf
.
int32
,
shape
=
[
batch_size
,
1
])
valid_dataset
=
tf
.
constant
(
valid_examples
,
dtype
=
tf
.
int32
)
# Construct the variables.
embeddings
=
tf
.
Variable
(
tf
.
random_uniform
([
vocabulary_size
,
embedding_size
],
-
1.0
,
1.0
))
nce_weights
=
tf
.
Variable
(
tf
.
truncated_normal
([
vocabulary_size
,
embedding_size
],
stddev
=
1.0
/
math
.
sqrt
(
embedding_size
)))
nce_biases
=
tf
.
Variable
(
tf
.
zeros
([
vocabulary_size
]))
# Look up embeddings for inputs.
embed
=
tf
.
nn
.
embedding_lookup
(
embeddings
,
train_inputs
)
# Ops and variables pinned to the CPU because of missing GPU implementation
with
tf
.
device
(
'/cpu:0'
):
# Look up embeddings for inputs.
embeddings
=
tf
.
Variable
(
tf
.
random_uniform
([
vocabulary_size
,
embedding_size
],
-
1.0
,
1.0
))
embed
=
tf
.
nn
.
embedding_lookup
(
embeddings
,
train_inputs
)
# Construct the variables for the NCE loss
nce_weights
=
tf
.
Variable
(
tf
.
truncated_normal
([
vocabulary_size
,
embedding_size
],
stddev
=
1.0
/
math
.
sqrt
(
embedding_size
)))
nce_biases
=
tf
.
Variable
(
tf
.
zeros
([
vocabulary_size
]))
# Compute the average NCE loss for the batch.
# tf.nce_loss automatically draws a new sample of the negative labels each
...
...
tensorflow/g3doc/api_docs/python/framework.md
浏览文件 @
10f23637
...
...
@@ -1408,7 +1408,7 @@ and Python scalars. For example:
```
python
import
numpy
as
np
array
=
np
.
random
.
rand
(
(
32
,
100
,
100
)
)
array
=
np
.
random
.
rand
(
32
,
100
,
100
)
def
my_func
(
arg
):
arg
=
tf
.
convert_to_tensor
(
arg
,
dtype
=
tf
.
float32
)
...
...
tensorflow/g3doc/resources/dims_types.md
浏览文件 @
10f23637
...
...
@@ -54,14 +54,14 @@ Data type | Python type | Description
--- | --- | ---
`DT_FLOAT`
|
`tf.float32`
| 32 bits floating point.
`DT_DOUBLE`
|
`tf.float64`
| 64 bits floating point.
`DT_INT64`
|
`tf.int64`
| 64 bits signed integer.
`DT_INT32`
|
`tf.int32`
| 32 bits signed integer.
`DT_INT16`
|
`tf.int16`
| 16 bits signed integer.
`DT_INT8`
|
`tf.int8`
| 8 bits signed integer.
`DT_INT16`
|
`tf.int16`
| 16 bits signed integer.
`DT_INT32`
|
`tf.int32`
| 32 bits signed integer.
`DT_INT64`
|
`tf.int64`
| 64 bits signed integer.
`DT_UINT8`
|
`tf.uint8`
| 8 bits unsigned integer.
`DT_STRING`
|
`tf.string`
| Variable length byte arrays. Each element of a Tensor is a byte array.
`DT_BOOL`
|
`tf.bool`
| Boolean.
`DT_COMPLEX64`
|
`tf.complex64`
| Complex number made of two 32 bits floating points: real and imaginary parts.
`DT_QINT32`
|
`tf.qint32`
| 32 bits signed integer used in quantized Ops.
`DT_QINT8`
|
`tf.qint8`
| 8 bits signed integer used in quantized Ops.
`DT_QUINT8`
|
`tf.quint8`
| 8 bits unsigned integer used in quantized Ops.
`DT_QINT32`
|
`tf.qint32`
| 32 bits signed integer used in quantized Ops.
`DT_QUINT8`
|
`tf.quint8`
| 8 bits unsigned integer used in quantized Ops.
\ No newline at end of file
tensorflow/g3doc/tutorials/deep_cnn/index.md
浏览文件 @
10f23637
...
...
@@ -126,7 +126,7 @@ artificially increase the data set size:
* [Randomly flip](../../api_docs/python/image.md#random_flip_left_right) the image from left to right.
* Randomly distort the [image brightness](../../api_docs/python/image.md#random_brightness).
* Randomly distort the [image contrast](../../api_docs/python/image.md#
tf_image_
random_contrast).
* Randomly distort the [image contrast](../../api_docs/python/image.md#random_contrast).
Please see the [Images](../../api_docs/python/image.md) page for the list of
available distortions. We also attach an
...
...
tensorflow/python/framework/ops.py
浏览文件 @
10f23637
...
...
@@ -486,7 +486,7 @@ def convert_to_tensor(value, dtype=None, name=None, as_ref=False):
```python
import numpy as np
array = np.random.rand(
(32, 100, 100)
)
array = np.random.rand(
32, 100, 100
)
def my_func(arg):
arg = tf.convert_to_tensor(arg, dtype=tf.float32)
...
...
tensorflow/python/ops/image_ops_test.py
浏览文件 @
10f23637
...
...
@@ -564,49 +564,56 @@ class ResizeImagesTest(test_util.TensorFlowTestCase):
image_ops
.
ResizeMethod
.
BICUBIC
,
image_ops
.
ResizeMethod
.
AREA
]
TYPES
=
[
np
.
uint8
,
np
.
int8
,
np
.
int16
,
np
.
int32
,
np
.
int64
,
np
.
float
,
np
.
double
]
def
testNoOp
(
self
):
img_shape
=
[
1
,
6
,
4
,
1
]
single_shape
=
[
6
,
4
,
1
]
data
=
[
128
,
128
,
64
,
64
,
128
,
128
,
64
,
64
,
64
,
64
,
128
,
128
,
64
,
64
,
128
,
128
,
# This test is also conducted with int8, so 127 is the maximum
# value that can be used.
data
=
[
127
,
127
,
64
,
64
,
127
,
127
,
64
,
64
,
64
,
64
,
127
,
127
,
64
,
64
,
127
,
127
,
50
,
50
,
100
,
100
,
50
,
50
,
100
,
100
]
img_np
=
np
.
array
(
data
,
dtype
=
np
.
uint8
).
reshape
(
img_shape
)
target_height
=
6
target_width
=
4
for
opt
in
self
.
OPTIONS
:
with
self
.
test_session
()
as
sess
:
image
=
constant_op
.
constant
(
img_np
,
shape
=
img_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
opt
)
yshape
=
array_ops
.
shape
(
y
)
resized
,
newshape
=
sess
.
run
([
y
,
yshape
])
self
.
assertAllEqual
(
img_shape
,
newshape
)
self
.
assertAllClose
(
resized
,
img_np
,
atol
=
1e-5
)
for
nptype
in
self
.
TYPES
:
img_np
=
np
.
array
(
data
,
dtype
=
nptype
).
reshape
(
img_shape
)
# Resizing with a single image must leave the shape unchanged also.
with
self
.
test_session
():
img_single
=
img_np
.
reshape
(
single_shape
)
image
=
constant_op
.
constant
(
img_single
,
shape
=
single_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
self
.
OPTIONS
[
0
])
yshape
=
array_ops
.
shape
(
y
)
newshape
=
yshape
.
eval
()
self
.
assertAllEqual
(
single_shape
,
newshape
)
for
opt
in
self
.
OPTIONS
:
with
self
.
test_session
()
as
sess
:
image
=
constant_op
.
constant
(
img_np
,
shape
=
img_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
opt
)
yshape
=
array_ops
.
shape
(
y
)
resized
,
newshape
=
sess
.
run
([
y
,
yshape
])
self
.
assertAllEqual
(
img_shape
,
newshape
)
self
.
assertAllClose
(
resized
,
img_np
,
atol
=
1e-5
)
def
testResizeDown
(
self
):
# Resizing with a single image must leave the shape unchanged also.
with
self
.
test_session
():
img_single
=
img_np
.
reshape
(
single_shape
)
image
=
constant_op
.
constant
(
img_single
,
shape
=
single_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
self
.
OPTIONS
[
0
])
yshape
=
array_ops
.
shape
(
y
)
newshape
=
yshape
.
eval
()
self
.
assertAllEqual
(
single_shape
,
newshape
)
data
=
[
128
,
128
,
64
,
64
,
128
,
128
,
64
,
64
,
64
,
64
,
128
,
128
,
64
,
64
,
128
,
128
,
def
testResizeDown
(
self
):
# This test is also conducted with int8, so 127 is the maximum
# value that can be used.
data
=
[
127
,
127
,
64
,
64
,
127
,
127
,
64
,
64
,
64
,
64
,
127
,
127
,
64
,
64
,
127
,
127
,
50
,
50
,
100
,
100
,
50
,
50
,
100
,
100
]
expected_data
=
[
12
8
,
64
,
64
,
12
8
,
expected_data
=
[
12
7
,
64
,
64
,
12
7
,
50
,
100
]
target_height
=
3
target_width
=
2
...
...
@@ -617,59 +624,61 @@ class ResizeImagesTest(test_util.TensorFlowTestCase):
[
target_height
,
target_width
,
1
]]
for
target_shape
,
img_shape
in
zip
(
target_shapes
,
img_shapes
):
img_np
=
np
.
array
(
data
,
dtype
=
np
.
uint8
).
reshape
(
img_shape
)
for
opt
in
self
.
OPTIONS
:
with
self
.
test_session
():
image
=
constant_op
.
constant
(
img_np
,
shape
=
img_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
opt
)
expected
=
np
.
array
(
expected_data
).
reshape
(
target_shape
)
resized
=
y
.
eval
()
self
.
assertAllClose
(
resized
,
expected
,
atol
=
1e-5
)
for
nptype
in
self
.
TYPES
:
img_np
=
np
.
array
(
data
,
dtype
=
nptype
).
reshape
(
img_shape
)
for
opt
in
self
.
OPTIONS
:
with
self
.
test_session
():
image
=
constant_op
.
constant
(
img_np
,
shape
=
img_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
opt
)
expected
=
np
.
array
(
expected_data
).
reshape
(
target_shape
)
resized
=
y
.
eval
()
self
.
assertAllClose
(
resized
,
expected
,
atol
=
1e-5
)
def
testResizeUp
(
self
):
img_shape
=
[
1
,
3
,
2
,
1
]
data
=
[
128
,
64
,
64
,
128
,
data
=
[
64
,
32
,
32
,
64
,
50
,
100
]
img_np
=
np
.
array
(
data
,
dtype
=
np
.
uint8
).
reshape
(
img_shape
)
target_height
=
6
target_width
=
4
expected_data
=
{}
expected_data
[
image_ops
.
ResizeMethod
.
BILINEAR
]
=
[
128.0
,
96.0
,
64.0
,
64
.0
,
96.0
,
96.0
,
96.0
,
96
.0
,
64.0
,
96.0
,
128.0
,
128
.0
,
57.0
,
85.5
,
114.0
,
114
.0
,
64.0
,
48.0
,
32.0
,
32
.0
,
48.0
,
48.0
,
48.0
,
48
.0
,
32.0
,
48.0
,
64.0
,
64
.0
,
41.0
,
61.5
,
82.0
,
82
.0
,
50.0
,
75.0
,
100.0
,
100.0
,
50.0
,
75.0
,
100.0
,
100.0
]
expected_data
[
image_ops
.
ResizeMethod
.
NEAREST_NEIGHBOR
]
=
[
128.0
,
128.0
,
64.0
,
64
.0
,
128.0
,
128.0
,
64.0
,
64
.0
,
64.0
,
64.0
,
128.0
,
128
.0
,
64.0
,
64.0
,
128.0
,
128
.0
,
64.0
,
64.0
,
32.0
,
32
.0
,
64.0
,
64.0
,
32.0
,
32
.0
,
32.0
,
32.0
,
64.0
,
64
.0
,
32.0
,
32.0
,
64.0
,
64
.0
,
50.0
,
50.0
,
100.0
,
100.0
,
50.0
,
50.0
,
100.0
,
100.0
]
expected_data
[
image_ops
.
ResizeMethod
.
AREA
]
=
[
128.0
,
128.0
,
64.0
,
64
.0
,
128.0
,
128.0
,
64.0
,
64
.0
,
64.0
,
64.0
,
128.0
,
128
.0
,
64.0
,
64.0
,
128.0
,
128
.0
,
64.0
,
64.0
,
32.0
,
32
.0
,
64.0
,
64.0
,
32.0
,
32
.0
,
32.0
,
32.0
,
64.0
,
64
.0
,
32.0
,
32.0
,
64.0
,
64
.0
,
50.0
,
50.0
,
100.0
,
100.0
,
50.0
,
50.0
,
100.0
,
100.0
]
for
opt
in
[
image_ops
.
ResizeMethod
.
BILINEAR
,
image_ops
.
ResizeMethod
.
NEAREST_NEIGHBOR
,
image_ops
.
ResizeMethod
.
AREA
]:
with
self
.
test_session
():
image
=
constant_op
.
constant
(
img_np
,
shape
=
img_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
opt
)
resized
=
y
.
eval
()
expected
=
np
.
array
(
expected_data
[
opt
]).
reshape
(
[
1
,
target_height
,
target_width
,
1
])
self
.
assertAllClose
(
resized
,
expected
,
atol
=
1e-05
)
for
nptype
in
self
.
TYPES
:
for
opt
in
[
image_ops
.
ResizeMethod
.
BILINEAR
,
image_ops
.
ResizeMethod
.
NEAREST_NEIGHBOR
,
image_ops
.
ResizeMethod
.
AREA
]:
with
self
.
test_session
():
img_np
=
np
.
array
(
data
,
dtype
=
nptype
).
reshape
(
img_shape
)
image
=
constant_op
.
constant
(
img_np
,
shape
=
img_shape
)
y
=
image_ops
.
resize_images
(
image
,
target_height
,
target_width
,
opt
)
resized
=
y
.
eval
()
expected
=
np
.
array
(
expected_data
[
opt
]).
reshape
(
[
1
,
target_height
,
target_width
,
1
])
self
.
assertAllClose
(
resized
,
expected
,
atol
=
1e-05
)
def
testResizeUpBicubic
(
self
):
img_shape
=
[
1
,
6
,
6
,
1
]
...
...
tensorflow/python/ops/template.py
浏览文件 @
10f23637
...
...
@@ -187,7 +187,7 @@ class Template(object):
"meant tf.get_variable: %s"
,
variables
[
vars_at_start
:])
return
result
except
Exception
,
exc
:
except
Exception
as
exc
:
# Reraise the exception, but append the original definition to the
# trace.
args
=
exc
.
args
...
...
tensorflow/python/training/coordinator.py
浏览文件 @
10f23637
...
...
@@ -70,7 +70,7 @@ class Coordinator(object):
try:
while not coord.should_stop():
...do some work...
except Exception
,
e:
except Exception
as
e:
coord.request_stop(e)
```
...
...
@@ -85,7 +85,7 @@ class Coordinator(object):
...start thread N...(coord, ...)
# Wait for all the threads to terminate.
coord.join(threads)
except Exception
,
e:
except Exception
as
e:
...exception that was passed to coord.request_stop()
```
...
...
@@ -188,7 +188,7 @@ class Coordinator(object):
```python
try:
...body...
exception Exception
,
ex:
exception Exception
as
ex:
coord.request_stop(ex)
```
...
...
@@ -198,7 +198,7 @@ class Coordinator(object):
# pylint: disable=broad-except
try
:
yield
except
Exception
,
ex
:
except
Exception
as
ex
:
self
.
request_stop
(
ex
)
# pylint: enable=broad-except
...
...
tensorflow/stream_executor/BUILD
浏览文件 @
10f23637
...
...
@@ -19,6 +19,7 @@ cc_library(
),
hdrs
=
glob
([
"*.h"
,
"cuda/*.h"
,
"lib/*.h"
,
"platform/**/*.h"
,
]),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录