Skip to content

Commit dc02bfd

Browse files
committed
Add list type of feeding
1 parent 4a99c44 commit dc02bfd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/paddle/v2/data_feeder.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from py_paddle import DataProviderConverter
16-
16+
import collections
1717
import paddle.trainer.PyDataProvider2 as pydp2
1818

1919
__all__ = ['DataFeeder']
@@ -75,6 +75,13 @@ def __init__(self, data_types, feeding=None):
7575
input_types = []
7676
if feeding is None:
7777
feeding = default_feeding_map(data_types)
78+
elif isinstance(feeding, collections.Sequence):
79+
feed_list = feeding
80+
feeding = dict()
81+
for i, name in enumerate(feed_list):
82+
feeding[name] = i
83+
elif not isinstance(feeding, dict):
84+
raise TypeError("Feeding should be dict or sequence or None.")
7885

7986
self.feeding = feeding
8087
for each in data_types:

0 commit comments

Comments
 (0)