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
OpenDAS
vision
Commits
015eb46b
Unverified
Commit
015eb46b
authored
Oct 19, 2021
by
Nicolas Hug
Committed by
GitHub
Oct 19, 2021
Browse files
Pass indexing param to meshgrid to avoid warning (#4645)
parent
29dcf767
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
test/test_io.py
test/test_io.py
+1
-1
torchvision/models/detection/anchor_utils.py
torchvision/models/detection/anchor_utils.py
+2
-2
No files found.
test/test_io.py
View file @
015eb46b
...
...
@@ -23,7 +23,7 @@ VIDEO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "
def
_create_video_frames
(
num_frames
,
height
,
width
):
y
,
x
=
torch
.
meshgrid
(
torch
.
linspace
(
-
2
,
2
,
height
),
torch
.
linspace
(
-
2
,
2
,
width
))
y
,
x
=
torch
.
meshgrid
(
torch
.
linspace
(
-
2
,
2
,
height
),
torch
.
linspace
(
-
2
,
2
,
width
)
,
indexing
=
"ij"
)
data
=
[]
for
i
in
range
(
num_frames
):
xc
=
float
(
i
)
/
num_frames
...
...
torchvision/models/detection/anchor_utils.py
View file @
015eb46b
...
...
@@ -104,7 +104,7 @@ class AnchorGenerator(nn.Module):
# For output anchor, compute [x_center, y_center, x_center, y_center]
shifts_x
=
torch
.
arange
(
0
,
grid_width
,
dtype
=
torch
.
int32
,
device
=
device
)
*
stride_width
shifts_y
=
torch
.
arange
(
0
,
grid_height
,
dtype
=
torch
.
int32
,
device
=
device
)
*
stride_height
shift_y
,
shift_x
=
torch
.
meshgrid
(
shifts_y
,
shifts_x
)
shift_y
,
shift_x
=
torch
.
meshgrid
(
shifts_y
,
shifts_x
,
indexing
=
"ij"
)
shift_x
=
shift_x
.
reshape
(
-
1
)
shift_y
=
shift_y
.
reshape
(
-
1
)
shifts
=
torch
.
stack
((
shift_x
,
shift_y
,
shift_x
,
shift_y
),
dim
=
1
)
...
...
@@ -222,7 +222,7 @@ class DefaultBoxGenerator(nn.Module):
shifts_x
=
((
torch
.
arange
(
0
,
f_k
[
1
])
+
0.5
)
/
x_f_k
).
to
(
dtype
=
dtype
)
shifts_y
=
((
torch
.
arange
(
0
,
f_k
[
0
])
+
0.5
)
/
y_f_k
).
to
(
dtype
=
dtype
)
shift_y
,
shift_x
=
torch
.
meshgrid
(
shifts_y
,
shifts_x
)
shift_y
,
shift_x
=
torch
.
meshgrid
(
shifts_y
,
shifts_x
,
indexing
=
"ij"
)
shift_x
=
shift_x
.
reshape
(
-
1
)
shift_y
=
shift_y
.
reshape
(
-
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