Skip to content

Enable ROCm devices to correctly use keras.layers.CuDNNGRU and keras.layers.CuDNNLSTM #21443

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

Open
wants to merge 7 commits into
base: r2.13
Choose a base branch
from

Conversation

JoeNan1
Copy link

@JoeNan1 JoeNan1 commented Jul 1, 2025

Using keras.layers.CuDNNGRU and keras.layers.CuDNNLSTM on ROCm devices may introduce accuracy issues due to incorrect weight layout. This modification ensures compatibility with both CUDA and ROCm weight layouts.

@gbaned gbaned requested a review from amitsrivastava78 July 2, 2025 18:16
@gbaned gbaned added this to PR Queue Jul 2, 2025
@github-project-automation github-project-automation bot moved this to Assigned Reviewer in PR Queue Jul 2, 2025
@@ -20,7 +20,7 @@ jobs:
python -m pip install --upgrade pip setuptools
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
uses: actions/cache@v4
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove these 2 files from the PR

Copy link
Author

Choose a reason for hiding this comment

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

Reverted to the original state before the changes.

self.bias[self.units * 5 :],
]

if tf.sysconfig.get_build_info()["is_cuda_build"]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Author

Choose a reason for hiding this comment

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

The default layout is compatible with ROCm; here, the CUDA layout is adapted by checking whether the device is CUDA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

3 participants