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
0d00f1a6
Commit
0d00f1a6
authored
Dec 21, 2019
by
Ye Liu
Committed by
Kai Chen
Dec 21, 2019
Browse files
Fix int support in mmcv.slice_list (#161)
parent
ead4bc39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
mmcv/utils/misc.py
mmcv/utils/misc.py
+4
-1
No files found.
mmcv/utils/misc.py
View file @
0d00f1a6
...
@@ -110,8 +110,11 @@ def slice_list(in_list, lens):
...
@@ -110,8 +110,11 @@ def slice_list(in_list, lens):
Returns:
Returns:
list: A list of sliced list.
list: A list of sliced list.
"""
"""
if
isinstance
(
lens
,
int
):
assert
len
(
in_list
)
%
lens
==
0
lens
=
[
lens
]
*
int
(
len
(
in_list
)
/
lens
)
if
not
isinstance
(
lens
,
list
):
if
not
isinstance
(
lens
,
list
):
raise
TypeError
(
'"indices" must be a list of integers'
)
raise
TypeError
(
'"indices" must be
an integer or
a list of integers'
)
elif
sum
(
lens
)
!=
len
(
in_list
):
elif
sum
(
lens
)
!=
len
(
in_list
):
raise
ValueError
(
raise
ValueError
(
'sum of lens and list length does not match: {} != {}'
.
format
(
'sum of lens and list length does not match: {} != {}'
.
format
(
...
...
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