Skip to content

Cleanup for the destructor in Tensor class #7

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 1 commit into
base: master
Choose a base branch
from

Conversation

gouthamk16
Copy link

TODO item for ensuring proper cleanup in the Tensor class's del method. The implementation now includes a try-except block to handle cases where the lib may be unavailable during Python interpreter shutdown. This prevents potential exceptions from being raised and ensures that Tensor objects are cleaned up safely.

Changes:
-> Added a try-except block in the del method to handle cleanup safely.
-> The lib.tensor_free function is now called only if the lib is available, avoiding issues during interpreter shutdown.

@karpathy
Copy link
Contributor

I guess I still don't fully understand the interpreter <-> cffi interaction here and if there is a "proper" way to do handle this.

@gouthamk16
Copy link
Author

Oh. Let me see if i can work on the python cffi connection and if there is any other way to do this properly.

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.

2 participants