Skip to content

Commit

Permalink
Merge pull request #2636 from jacquesqiao/fix-converter
Browse files Browse the repository at this point in the history
fix dim problem
  • Loading branch information
jacquesqiao authored Jun 28, 2017
2 parents 633082a + e93c3e4 commit 1a0fdb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/getstarted/concepts/use_concepts_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ PaddlePaddle支持不同类型的输入数据,主要包括四种类型,和
# define training dataset reader
def train_reader():
train_x = np.array([[1, 1], [1, 2], [3, 4], [5, 2]])
train_y = np.array([-2, -3, -7, -7])
train_y = np.array([[-2], [-3], [-7], [-7]])
def reader():
for i in xrange(train_y.shape[0]):
yield train_x[i], train_y[i]
Expand Down
4 changes: 4 additions & 0 deletions paddle/py_paddle/dataprovider_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def pre_scan(self, dat):
if len(self.__shape__) > 3:
raise ValueError(
"The dimension of input cannot be greater than 3.")
if len(self.__shape__) == 0:
raise ValueError(
"The input should be a vector, please check your input data."
)
self.__dim__ = reduce(lambda x, y: x * y, self.__shape__)
if len(self.__shape__) == 1 and self.__dim__ != self.input_type.dim:
raise ValueError(
Expand Down

0 comments on commit 1a0fdb9

Please sign in to comment.