Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
7510f165
Commit
7510f165
authored
Nov 18, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[STN] integer clip_by_value is so slow..
parent
7d3a24eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tensorpack/models/image_sample.py
tensorpack/models/image_sample.py
+3
-3
No files found.
tensorpack/models/image_sample.py
View file @
7510f165
...
@@ -20,14 +20,14 @@ def sample(img, coords):
...
@@ -20,14 +20,14 @@ def sample(img, coords):
Return:
Return:
bxh2xw2xc image
bxh2xw2xc image
"""
"""
coords
=
tf
.
to_int32
(
coords
)
shape
=
img
.
get_shape
()
.
as_list
()[
1
:]
# h, w, c
shape
=
img
.
get_shape
()
.
as_list
()[
1
:]
# h, w, c
batch
=
tf
.
shape
(
img
)[
0
]
batch
=
tf
.
shape
(
img
)[
0
]
shape2
=
coords
.
get_shape
()
.
as_list
()[
1
:
3
]
# h2, w2
shape2
=
coords
.
get_shape
()
.
as_list
()[
1
:
3
]
# h2, w2
assert
None
not
in
shape2
,
coords
.
get_shape
()
assert
None
not
in
shape2
,
coords
.
get_shape
()
max_coor
=
tf
.
constant
([
shape
[
0
]
-
1
,
shape
[
1
]
-
1
],
dtype
=
tf
.
in
t32
)
max_coor
=
tf
.
constant
([
shape
[
0
]
-
1
,
shape
[
1
]
-
1
],
dtype
=
tf
.
floa
t32
)
coords
=
tf
.
clip_by_value
(
coords
,
0
,
max_coor
)
# borderMode==repeat
coords
=
tf
.
clip_by_value
(
coords
,
0.
,
max_coor
)
# borderMode==repeat
coords
=
tf
.
to_int32
(
coords
)
batch_index
=
tf
.
range
(
batch
,
dtype
=
tf
.
int32
)
batch_index
=
tf
.
range
(
batch
,
dtype
=
tf
.
int32
)
batch_index
=
tf
.
reshape
(
batch_index
,
[
-
1
,
1
,
1
,
1
])
batch_index
=
tf
.
reshape
(
batch_index
,
[
-
1
,
1
,
1
,
1
])
...
...
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