Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dim problem #2636

Merged
merged 4 commits into from
Jun 28, 2017
Merged

fix dim problem #2636

merged 4 commits into from
Jun 28, 2017

Conversation

jacquesqiao
Copy link
Member

@jacquesqiao jacquesqiao commented Jun 28, 2017

fix #2564

check the input shape of dense_vector.

@@ -109,7 +109,10 @@ def pre_scan(self, dat):
if len(self.__shape__) > 3:
raise ValueError(
"The dimension of input cannot be greater than 3.")
self.__dim__ = reduce(lambda x, y: x * y, self.__shape__)
if len(self.__shape__) == 0:
self.__dim__ = 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discuss with @qingqing01 , we think if user configure to use a dence_vector, then the data type should be a vector and shape should not be zero

@@ -109,7 +109,10 @@ def pre_scan(self, dat):
if len(self.__shape__) > 3:
raise ValueError(
"The dimension of input cannot be greater than 3.")
self.__dim__ = reduce(lambda x, y: x * y, self.__shape__)
if len(self.__shape__) == 0:
self.__dim__ = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DenseScanner must accept the data type dense_vector. So the dat in line 108 must be a list ([]) or numpy.array. See the input type doc.

The format of input data in issue is not correct.

Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM.

@jacquesqiao jacquesqiao merged commit 1a0fdb9 into PaddlePaddle:develop Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

运行示例中的代码,得到错误:reduce() of empty sequence with no initial value
2 participants