Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

02 - Variable.py Bias vector dimension error and python style #27

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

Closed
yongkyunlee wants to merge 3 commits into golbin:master from yongkyunlee:master

Conversation

Copy link

@yongkyunlee yongkyunlee commented Dec 22, 2017

There is an error in bias dimension and I think using with when creating tf session is better.

sess을 직접 열고 닫는 것보다 with을 활용해서 하는 것이 파이선 코딩 스타일에 더 맞는 것 같습니다.
참고: https://google.github.io/styleguide/pyguide.html Files and Sockets 섹션
X의 차원은 ? * 3 이고 W의 차원은 3 * 2 이기 때문에 X * W의 차원은 ? * 2 가 됩니다.
bias는 X * W의 각 행에 더해져야 하기 때문에 b의 차원은 1 * 2 이어야 합니다.
Explicit expression of dimension.
Use format instead of % for print
Copy link
Owner

golbin commented Dec 27, 2017

It's the first sample so I don't use with keyword for making more simple.

And there is no error /w bias 2x1 dimension.

Thanks for your feedback.

Copy link
Author

bias should be 1 x 2 dimension
Let's say X has dimension 4 x 3
Since W has dimension 3 x 2, matmul(X, W) will have dimension 4 * 2
If b has dimension 2 * 1, matmul(X, W) + b cannot mathematically work.
If b has dimension 1 * 2, matmul(X, W) + b outputs 4 * 2, which is exactly what we want.
Because your example uses X that has dimension 2 * 3, your current code seems to work well (as it coincidentally fit nicely with current b dimension), but you should try the code with X that has dimension 4 * 3. Then you will realize that the code doesn't work because of wrong b dimension.

Copy link
Owner

golbin commented Dec 27, 2017

@NonInertialFrame I got it what you mean. I'll fix it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /