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
MMCV
Commits
fe4f657f
Unverified
Commit
fe4f657f
authored
Jun 02, 2020
by
Miguel Mendez
Committed by
GitHub
Jun 02, 2020
Browse files
Fix deprecation warning collections.abc (#312)
* Fix deprecation warning collections.abc * Fix isort
parent
efecf7d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
mmcv/parallel/collate.py
mmcv/parallel/collate.py
+4
-4
No files found.
mmcv/parallel/collate.py
View file @
fe4f657f
# Copyright (c) Open-MMLab. All rights reserved.
import
collections
from
collections
.abc
import
Mapping
,
Sequence
import
torch
import
torch.nn.functional
as
F
...
...
@@ -20,7 +20,7 @@ def collate(batch, samples_per_gpu=1):
3. cpu_only = False, stack = False, e.g., gt bboxes
"""
if
not
isinstance
(
batch
,
collections
.
Sequence
):
if
not
isinstance
(
batch
,
Sequence
):
raise
TypeError
(
f
'
{
batch
.
dtype
}
is not supported.'
)
if
isinstance
(
batch
[
0
],
DataContainer
):
...
...
@@ -73,10 +73,10 @@ def collate(batch, samples_per_gpu=1):
stacked
.
append
(
[
sample
.
data
for
sample
in
batch
[
i
:
i
+
samples_per_gpu
]])
return
DataContainer
(
stacked
,
batch
[
0
].
stack
,
batch
[
0
].
padding_value
)
elif
isinstance
(
batch
[
0
],
collections
.
Sequence
):
elif
isinstance
(
batch
[
0
],
Sequence
):
transposed
=
zip
(
*
batch
)
return
[
collate
(
samples
,
samples_per_gpu
)
for
samples
in
transposed
]
elif
isinstance
(
batch
[
0
],
collections
.
Mapping
):
elif
isinstance
(
batch
[
0
],
Mapping
):
return
{
key
:
collate
([
d
[
key
]
for
d
in
batch
],
samples_per_gpu
)
for
key
in
batch
[
0
]
...
...
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