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

Workaround for h5py memory leak #227

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fastmri/data/mri_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ def __getitem__(self, i: int):
fname, dataslice, metadata = self.examples[i]

with h5py.File(fname, "r") as hf:
kspace = hf["kspace"][dataslice]
kspace = hf["kspace"][dataslice].copy()
Copy link
Contributor

Choose a reason for hiding this comment

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

Throws an error.


mask = np.asarray(hf["mask"]) if "mask" in hf else None
mask = np.asarray(hf["mask"].copy()) if "mask" in hf else None
Copy link
Contributor

Choose a reason for hiding this comment

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

Throws an error.


target = hf[self.recons_key][dataslice] if self.recons_key in hf else None
target = hf[self.recons_key][dataslice].copy() if self.recons_key in hf else None
Copy link
Contributor

Choose a reason for hiding this comment

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

Throws an error.


attrs = dict(hf.attrs)
attrs.update(metadata)
Expand Down