Movatterモバイル変換


[0]ホーム

URL:


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

Fix shape mismatch error during backpropagation in MLP optimizer#96

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
achal-khanna wants to merge1 commit intoddbourgin:master
base:master
Choose a base branch
Loading
fromachal-khanna:fix-optimizer-shape-mismatch

Conversation

@achal-khanna
Copy link

This submission addresses the issue tracked in#78.

Root Cause

In optimizers like Adam and SGD, theself.cache was shared among all layers, leading to a situation where the cache keys were simplyW andb. As a result, when different layers attempted to update their parameters, they all referred to the same cache entries. This led to shape mismatches because the updates for different layers were not properly isolated.

For instance, the cache should have unique keys likelayer1-W,layer1-b,layer2-W, etc., but instead, all parameters were using the same keys, resulting in conflicts during backpropagation.

Solution

The solution involved ensuring that each layer maintained its own cache. This was done by creating a deepcopy of the optimizer linked to each specific layer during its initialization. This way, each layer could independently manage its cache.

All Submissions

  • Is the code you are submitting your own work?
  • Have you followed thecontributing guidelines?
  • Have you checked to ensure there aren't other openPull Requests for the same update/change?

Changes to Existing Models

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Sign up for freeto 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.

1 participant

@achal-khanna

[8]ページ先頭

©2009-2025 Movatter.jp