Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
eb7c6e43
Unverified
Commit
eb7c6e43
authored
Jan 23, 2018
by
Neal Wu
Committed by
GitHub
Jan 23, 2018
Browse files
Merge pull request #3220 from cclauss/long-was-removed-in-python3
long was removed in Python 3 (en masse)
parents
1d31378d
7431515f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
research/brain_coder/common/utils.py
research/brain_coder/common/utils.py
+2
-1
research/compression/entropy_coder/lib/block_util.py
research/compression/entropy_coder/lib/block_util.py
+3
-2
research/object_detection/dataset_tools/create_oid_tf_record.py
...ch/object_detection/dataset_tools/create_oid_tf_record.py
+1
-1
research/object_detection/utils/ops.py
research/object_detection/utils/ops.py
+2
-2
No files found.
research/brain_coder/common/utils.py
View file @
eb7c6e43
...
@@ -12,6 +12,7 @@ import random
...
@@ -12,6 +12,7 @@ import random
from
absl
import
logging
from
absl
import
logging
import
numpy
as
np
import
numpy
as
np
import
six
from
six.moves
import
xrange
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -138,7 +139,7 @@ def stack_pad(tensors, pad_axes=None, pad_to_lengths=None, dtype=np.float32,
...
@@ -138,7 +139,7 @@ def stack_pad(tensors, pad_axes=None, pad_to_lengths=None, dtype=np.float32,
same_axes
=
dict
(
enumerate
(
max_lengths
))
same_axes
=
dict
(
enumerate
(
max_lengths
))
if
pad_axes
is
None
:
if
pad_axes
is
None
:
pad_axes
=
[]
pad_axes
=
[]
if
isinstance
(
pad_axes
,
(
int
,
long
)
):
if
isinstance
(
pad_axes
,
six
.
integer_types
):
if
pad_to_lengths
is
not
None
:
if
pad_to_lengths
is
not
None
:
max_lengths
[
pad_axes
]
=
pad_to_lengths
max_lengths
[
pad_axes
]
=
pad_to_lengths
del
same_axes
[
pad_axes
]
del
same_axes
[
pad_axes
]
...
...
research/compression/entropy_coder/lib/block_util.py
View file @
eb7c6e43
...
@@ -21,6 +21,7 @@ from __future__ import unicode_literals
...
@@ -21,6 +21,7 @@ from __future__ import unicode_literals
import
math
import
math
import
numpy
as
np
import
numpy
as
np
import
six
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -39,7 +40,7 @@ class RsqrtInitializer(object):
...
@@ -39,7 +40,7 @@ class RsqrtInitializer(object):
1.0 / sqrt(product(shape[dims]))
1.0 / sqrt(product(shape[dims]))
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
"""
"""
if
isinstance
(
dims
,
(
int
,
long
)
):
if
isinstance
(
dims
,
six
.
integer_types
):
self
.
_dims
=
[
dims
]
self
.
_dims
=
[
dims
]
else
:
else
:
self
.
_dims
=
dims
self
.
_dims
=
dims
...
@@ -73,7 +74,7 @@ class RectifierInitializer(object):
...
@@ -73,7 +74,7 @@ class RectifierInitializer(object):
sqrt(scale / product(shape[dims])).
sqrt(scale / product(shape[dims])).
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
**kwargs: Extra keyword arguments to pass to tf.truncated_normal.
"""
"""
if
isinstance
(
dims
,
(
int
,
long
)
):
if
isinstance
(
dims
,
six
.
integer_types
):
self
.
_dims
=
[
dims
]
self
.
_dims
=
[
dims
]
else
:
else
:
self
.
_dims
=
dims
self
.
_dims
=
dims
...
...
research/object_detection/dataset_tools/create_oid_tf_record.py
View file @
eb7c6e43
...
@@ -96,7 +96,7 @@ def main(_):
...
@@ -96,7 +96,7 @@ def main(_):
tf_example
=
oid_tfrecord_creation
.
tf_example_from_annotations_data_frame
(
tf_example
=
oid_tfrecord_creation
.
tf_example_from_annotations_data_frame
(
image_annotations
,
label_map
,
encoded_image
)
image_annotations
,
label_map
,
encoded_image
)
if
tf_example
:
if
tf_example
:
shard_idx
=
long
(
image_id
,
16
)
%
FLAGS
.
num_shards
shard_idx
=
int
(
image_id
,
16
)
%
FLAGS
.
num_shards
output_tfrecords
[
shard_idx
].
write
(
tf_example
.
SerializeToString
())
output_tfrecords
[
shard_idx
].
write
(
tf_example
.
SerializeToString
())
...
...
research/object_detection/utils/ops.py
View file @
eb7c6e43
...
@@ -203,9 +203,9 @@ def padded_one_hot_encoding(indices, depth, left_pad):
...
@@ -203,9 +203,9 @@ def padded_one_hot_encoding(indices, depth, left_pad):
TODO: add runtime checks for depth and indices.
TODO: add runtime checks for depth and indices.
"""
"""
if
depth
<
0
or
not
isinstance
(
depth
,
(
int
,
long
)
if
six
.
PY2
else
int
):
if
depth
<
0
or
not
isinstance
(
depth
,
six
.
integer_types
):
raise
ValueError
(
'`depth` must be a non-negative integer.'
)
raise
ValueError
(
'`depth` must be a non-negative integer.'
)
if
left_pad
<
0
or
not
isinstance
(
left_pad
,
(
int
,
long
)
if
six
.
PY2
else
int
):
if
left_pad
<
0
or
not
isinstance
(
left_pad
,
six
.
integer_types
):
raise
ValueError
(
'`left_pad` must be a non-negative integer.'
)
raise
ValueError
(
'`left_pad` must be a non-negative integer.'
)
if
depth
==
0
:
if
depth
==
0
:
return
None
return
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment