diff --git a/python/paddle/trainer/PyDataProvider2.py b/python/paddle/trainer/PyDataProvider2.py index afde7453a15fc0cc0196efac807dcc407869ec54..4e3c4db853205bb12272e86295784a6069483ffe 100644 --- a/python/paddle/trainer/PyDataProvider2.py +++ b/python/paddle/trainer/PyDataProvider2.py @@ -65,11 +65,11 @@ def sparse_value_slot(dim, seq_type=SequenceType.NO_SEQUENCE): return InputType(dim, seq_type, DataType.SparseValue) -def index_slot(ele_range, seq_type=SequenceType.NO_SEQUENCE): +def index_slot(value_range, seq_type=SequenceType.NO_SEQUENCE): """Data type of integer. - :param ele_range: range of this integer. + :param value_range: range of this integer. """ - return InputType(ele_range, seq_type, DataType.Index) + return InputType(value_range, seq_type, DataType.Index) dense_vector = dense_slot @@ -103,11 +103,11 @@ def sparse_vector_sub_sequence(dim): return sparse_vector(dim, seq_type=SequenceType.SUB_SEQUENCE) -def integer_value_sequence(ele_range): +def integer_value_sequence(value_range): """Data type of a sequence of integer. - :param ele_range: range of each element. + :param value_range: range of each element. """ - return integer_value(ele_range, seq_type=SequenceType.SEQUENCE) + return integer_value(value_range, seq_type=SequenceType.SEQUENCE) def integer_value_sub_sequence(dim): diff --git a/python/paddle/v2/tests/test_data_feeder.py b/python/paddle/v2/tests/test_data_feeder.py index 1b1f5aef8b811b320d382d558afb3532932b3ebf..71eb3bf31425c22b47accc11c9550042e077ef12 100644 --- a/python/paddle/v2/tests/test_data_feeder.py +++ b/python/paddle/v2/tests/test_data_feeder.py @@ -110,14 +110,14 @@ class DataFeederTest(unittest.TestCase): self.assertAlmostEqual(value.all(), w[i].all()) def test_integer(self): - ele_range = 100 + value_range = 100 batch_size = 32 index = [] for i in xrange(batch_size): each_sample = [] - each_sample.append(np.random.randint(ele_range)) + each_sample.append(np.random.randint(value_range)) index.append(each_sample) - feeder = DataFeeder([('input', data_type.integer_value(ele_range))], + feeder = DataFeeder([('input', data_type.integer_value(value_range))], {'input': 0}) arg = feeder(index) output = arg.getSlotIds(0).copyToNumpyArray() @@ -125,7 +125,7 @@ class DataFeederTest(unittest.TestCase): self.assertEqual(output.all(), index.flatten().all()) def test_integer_sequence(self): - ele_range = 10000 + value_range = 10000 batch_size = 32 start = [0] data = [] @@ -133,11 +133,11 @@ class DataFeederTest(unittest.TestCase): each_sample = [] each_sample.append( self.sparse_binary_reader( - ele_range, 30, non_empty=True)) + value_range, 30, non_empty=True)) data.append(each_sample) start.append(len(each_sample[0]) + start[-1]) feeder = DataFeeder( - [('input', data_type.integer_value_sequence(ele_range))], + [('input', data_type.integer_value_sequence(value_range))], {'input': 0}) arg = feeder(data) output_data = arg.getSlotIds(0).copyToNumpyArray()