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
c5fd5e17
You need to sign in or sign up before continuing.
Commit
c5fd5e17
authored
Aug 21, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #870
parent
4d71805b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
tensorpack/dataflow/common.py
tensorpack/dataflow/common.py
+4
-4
No files found.
tensorpack/dataflow/common.py
View file @
c5fd5e17
...
...
@@ -290,12 +290,12 @@ class MapDataComponent(MapData):
def
__init__
(
self
,
ds
,
func
,
index
=
0
):
"""
Args:
ds (DataFlow): input DataFlow.
ds (DataFlow): input DataFlow
which produces either list or dict
.
func (TYPE -> TYPE|None): takes ``dp[index]``, returns a new value for ``dp[index]``.
return None to discard this datapoint.
index (int
): index
of the component.
index (int
or str): index or key
of the component.
"""
self
.
_index
=
in
t
(
index
)
self
.
_index
=
in
dex
self
.
_func
=
func
super
(
MapDataComponent
,
self
)
.
__init__
(
ds
,
self
.
_mapper
)
...
...
@@ -303,7 +303,7 @@ class MapDataComponent(MapData):
r
=
self
.
_func
(
dp
[
self
.
_index
])
if
r
is
None
:
return
None
dp
=
list
(
dp
)
# shallow copy to avoid modifying the list
dp
=
copy
(
dp
)
# shallow copy to avoid modifying the list
dp
[
self
.
_index
]
=
r
return
dp
...
...
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